Skip to content

Commit

Permalink
Add a CAPTCHA check during registration (#460)
Browse files Browse the repository at this point in the history
* Pull in captcha lib

* wip

* Seed captcha with raw_rand

* wip

* Add backend code for generating captcha challenges

* Add frontend flow for captcha

* Remove StaticRng

* Small renaming

* Format ts

* Fail to move captcha

* Finish moving captcha to confirm screen

* Captcha clean up

* Retry captcha on failure

* Clean up captcha retry

* Update backend-test.hs did

* Fix did file

* Bump haskell-candid and update hs deps

* Fix build issues in backend-tests

Though tests are unlikely to pass

* Bump GHC version on CI

* Revert GHC to 884 and fix freeze accordingly

* Make sure aeson is recent enough

* Reset canister randomness before register

* Simplify captcha for tests

* Revert cabal files

* Use correct webauthPK in backend-tests

* Add captcha input in e2e tests

* Show text when captcha didn't work

* Try debugging lost request

* Dummy commit to trigger Actions

* Run formatter

* Fix backend-tests files

* Try fixing e2e-tests

* Update backend-tests post rebase

* Change disabled logic in confirmRegister

* npm run format

* Bump captcha waitForEnabled timeout to 10s

* Disabled e2e tests to populate cache

* Re-enable e2e-tests

* Disable emulator e2e tests

* Add conditional compilation for emulator

* Rename captcha feature and use in tests

* Add conditional USE_DUMMY_CAPTCHA build

* Re-enable selenium emulator tests

* Clean up rust CAPTCHA code

* Document dummy_captcha

* Clean up frontend code

* Add some TODOs

* Update lodepng-rust

* Clean up backend-tests

* Rename CaptchaResponse

* Clean up frontend code more

* Improve CAPTCHA trap messages

* Move ProofOfWork to create_challenge

* Make ChallengeKey a string

* Show error if captcha is wrong

* Remove leftover

* Return 'BadChallenge' on bad CAPTCHA

* Post rebase fix

* Clean up

* Add about USE_DUMMY_BUILD in backend tests

* Remove fake comment

* Bump number of inflight challenges to 500

* Clarify error message

* Remove old logs

* Link to tickets for updating libs

* Update lodepng-rust

* Disable selenium tests to populate GH cache

* Re-enable tests

* Wait for enabled captchaInput

* Bump CAPTCHA timeout

* Clarify USE_DUMMY_CAPTCHA usage

* Request CAPTCHA during Identity creation

* Add metric for inflight challenges
  • Loading branch information
nmattia authored Dec 6, 2021
1 parent e039644 commit 504649d
Show file tree
Hide file tree
Showing 18 changed files with 1,212 additions and 318 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
key: ${{ runner.os }}-cargo-dummy-captcha-${{ hashFiles('**/Cargo.lock') }}-1

- name: Cache ~/.cabal/store
uses: actions/cache@v2
Expand Down Expand Up @@ -66,7 +66,9 @@ jobs:
- name: Build backend canister
run: |
cargo build --target wasm32-unknown-unknown --release
# we use the dummy_captcha feature which ensures the captcha string
# is always "a"
cargo build --features dummy_captcha --target wasm32-unknown-unknown --release
- name: Run Tests
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/selenium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
- name: Deploy Internet Identity
run: |
export II_ENV=development
# we use the dummy_captcha feature which ensures the captcha string
# is always "a"
export USE_DUMMY_CAPTCHA=1
dfx deploy --no-wallet --argument '(null)'
- name: Deploy whoami canister
Expand Down
Loading

0 comments on commit 504649d

Please sign in to comment.