feat: add verifyWithSession verifier entry point for session-bound proofs - #862
Merged
kilianglas merged 23 commits intoAug 5, 2026
Merged
Conversation
1 task
…uniqueness-session-binding-contracts
…hub.com:worldcoin/world-id-protocol into kilianglas/uniqueness-session-binding-contracts
This was referenced Jul 14, 2026
Dzejkop
reviewed
Jul 16, 2026
Dzejkop
reviewed
Jul 16, 2026
Zero is the circuit's "no session" sentinel, satisfiable by any World ID regardless of mt_index, so a session record left at zero could be satisfied by an arbitrary World ID with a patched authenticator. verifyWithSession already rejected it; apply the same check to verifySession. V2 only — older implementations are immutable. Reported via HackerOne #3912490. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
V2 is released and immutable, so the new entry point and the session id validation move to a new version instead of extending V2 in place. - IWorldIDVerifierV3 declares verifyWithSession + InvalidSessionId - WorldIDVerifierV3 implements verifyWithSession and overrides verifySession to reject sessionId == 0 - WorldIDVerifierV2.sol is restored byte-identical to main; InvalidAction stays declared inline there and V3 inherits it - V2 tests return to their original set (regenerated fixture values only); the binding and zero-session cases move to WorldIDVerifierV3Test - test-utils deploys V3 behind the proxy; e2e and the fixture tool retarget Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The regenerated fixture values were unnecessary: all six V2 tests are negative (four revert on InvalidAction before any proof math, two expect ProofInvalid), so they pass unchanged against the refreshed mocks. Leaves the PR with no V2 footprint at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The verifySession zero-session check is a separate security fix and moves to its own PR against main. V3 here adds only the new entry point. Depends on that PR landing for the session-proof hardening. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…uniqueness-session-binding-contracts
Follows the error moving onto the V2 interface on main. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…-session-binding-contracts # Conflicts: # contracts/test/core/WorldIDVerifierV3Test.t.sol # crates/core/tests/generate_proof.rs # docs/world-id-4-specs/README.md
test_BoundSuccess verifies a real bound proof end-to-end, which necessarily passes both guards, so the synthetic case adds nothing. Also trims a comment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kilianglas
enabled auto-merge (squash)
August 5, 2026 14:29
paolodamico
reviewed
Aug 5, 2026
|
|
||
| /** | ||
| * @title WorldIDVerifier | ||
| * @title WorldIDVerifierV2 |
Collaborator
There was a problem hiding this comment.
should we still update V2 or is this V3 now? CC @Dzejkop
| uint64 constant credentialIssuerIdWrong = 2; | ||
|
|
||
| uint64 constant rpIdCorrect = 0x1a6ccf8f70e5de68; | ||
| uint64 constant rpIdCorrect = 0x387df34f862cd4e; |
Collaborator
There was a problem hiding this comment.
given these tests were part of an audit, is it possible to introduce a new module for V3 tests?
paolodamico
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a verifier entry point for Uniqueness Proofs bound to a session commitment. The client side (#855) emits proofs whose
session_idpublic signal carries the commitment;verify()pins that signal to0, so bound proofs need their own entry point. Verification logic is unchanged —verifyProofAndSignalsalready takessessionId.Extends the V3 verifier added in #882. No V2 file is touched.
Contracts
UnreleasedIWorldIDVerifierV3declaresverifyWithSession(...).UnreleasedWorldIDVerifierV3implements it: requires the uniqueness action prefix (MSB0x00,InvalidAction) andsessionId != 0(InvalidSessionId), then delegates toverifyProofAndSignals.verify()andverifySession()are unchanged; bound proofs are rejected byverify()and unbound proofs byverifyWithSession, so binding is explicit in both directions.Rust
RegistryTestContextdeploysWorldIDVerifierV3behind the proxy.generate-solidity-fixturesgains a bound-proof section: binds the request to the session fixture's id (cachedr), asserts the nullifier is unchanged, and verifies on-chain.verifyWithSession, alongside the existingverify()-rejects assertion.Tests & fixtures
WorldIDVerifierV3Testgoes from 4 to 11 tests: happy path, bound proof rejected byverify(), unbound rejected byverifyWithSession, wrong session id, action-prefix checks, zero session id.WorldIDVerifierTest.t.sol(shared mocks and merkle root) and the V3 test are regenerated as one consistent set — they can only be replaced together. The session fixture now carries its ownsessionNonceand a0x02-prefixed session action.