Skip to content

fix(registration)!: reject oversized vaults before insertion - #683

Closed
Dzejkop wants to merge 1 commit into
mainfrom
dzejkop/registration-vault-size
Closed

Dzejkop wants to merge 1 commit into
mainfrom
dzejkop/registration-vault-size

Conversation

@Dzejkop

@Dzejkop Dzejkop commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Rejects a supplied vault above MAX_VAULT_SIZE with ApproverError::VaultTooLarge before consuming the checked session or submitting InsertAuthenticator. The host may retry or abort. Removes ApprovalOutcome.vault_omitted and updates host documentation; None remains an explicit choice to register without a vault.

Validated serially through Nix: fmt; all/default/no-default workspace Clippy (all targets, warnings denied); 114 storage tests plus storage integration; 18 SQLite tests (one ignored); 11 DB tests; wasm32 walletkit-web check/Clippy; 27 registration unit tests. Full diff self-reviewed, including both registration plans, boundary sizes, retry/abort, and concurrent session consumption. Mobile and browser runtime tests were not run locally. CI advisory failure also occurs on main.

AI: GPT-6.1 Sol; prompted to return an explicit oversize-vault error before registration and update host-facing types, documentation, and regression tests.


Note

Medium Risk
Changes registration approval semantics and removes a public API field; hosts must handle VaultTooLarge instead of reading vault_omitted, but on-chain insertion is avoided when the vault is too large.

Overview
Oversized vault backup is no longer silently dropped during WIP-109 approval. CheckedRegistration::approve now returns ApproverError::VaultTooLarge when vault bytes exceed MAX_VAULT_SIZE, before the response channel is consumed or InsertAuthenticator is submitted, so the checked session stays open for a smaller vault, explicit None, or abort.

The host-facing ApprovalOutcome.vault_omitted field is removed (breaking for UniFFI consumers); outcomes now only carry registration result and delivery status.

Regression tests cover oversize rejection for both insert and already-registered plans, session retry after a size error, and integration/docs updates describing explicit vault sharing behavior.

Reviewed by Cursor Bugbot for commit 29663bd. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@Dzejkop
Dzejkop marked this pull request as ready for review November 18, 2026 14:47
Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:47
@wld-walletkit-bot

wld-walletkit-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Agent review · Approval withheld

Agent withheld approval

Reviewed commit: 29663bd659b63696e9385dd959dbdf25f68c2c90 · Workflow run

Agent recommendation: withhold approval

Withholding approval. The base-commit policy .code-review.md requires completed CodeRabbit and Copilot reviews covering the current changes. The prepared evidence contains zero reviews, zero review comments, and zero threads; the PR timeline shows only review requests and a copilot_work_started event. Live GitHub state now shows one completed Copilot review on the head SHA (state COMMENTED, 'Approval recommended', no open issues), but no CodeRabbit review exists anywhere on PR #683. CodeRabbit is a real reviewer in this repository (67 historical review comments), so its absence is a genuine coverage gap, not a naming artifact. Because CodeRabbit coverage is missing, the policy condition is unmet. Independently, the prepared evidence predates the Copilot review, so the evidence fingerprint has already changed and the approval gate would reject a positive verdict as 'evidence changed'. No dependency updates are involved.

Final agent response

**Decision: Withhold approval** for `worldcoin/walletkit#683` at `29663bd659b63696e9385dd959dbdf25f68c2c90`. `verdict.json` written to `/home/runner/work/_temp/review/verdict.json`.

**Blockers**
- **Policy requires completed CodeRabbit and Copilot reviews**, and CodeRabbit review is absent. The prepared `evidence.json` (fingerprint `fb4a00d3…`) has zero reviews/comments/threads. Live state now shows one completed Copilot review on the head SHA (`COMMENTED`, "Approval recommended", no open issues), but `coderabbitai[bot]`—a real reviewer in this repo with 67 historical review comments—has no review, review comment, or issue comment on this PR.
- **Evidence staleness:** the prepared evidence predates the Copilot review, so the fingerprint has already changed; the approve gate's recheck would reject even a positive verdict as "evidence changed."
- No unresolved threads or change requests, but missing CodeRabbit coverage alone fails `.code-review.md`.

**Independent review (non-blocking)**
- Oversize vaults now return `ApproverError::VaultTooLarge` before `take(&self.channel)?`, preserving the session for retry/abort; vault bytes remain `Zeroizing`; boundary `>` keeps exactly-`MAX_VAULT_SIZE` valid.
- `ApprovalOutcome.vault_omitted` fully removed with no stale Rust/Kotlin/Swift/TypeScript references; new UniFFI error variant is additive; docs and tests (both plans, retry at `None`/exact limit, abort ordering) are consistent.
- Minor nuance: the size check precedes channel acquisition, so a second `approve` on an already-handled session with an oversize vault reports `VaultTooLarge` instead of `AlreadyHandled`; session state is unaffected.

Approval must wait until CodeRabbit completes a review of the current head and any findings are substantively addressed (re-run all jobs afterward).
Structured review assessment

Review coverage

Prepared evidence.json (fingerprint fb4a00d3...) has reviews=[], comments=[], threads=[]. Live gh api repos/worldcoin/walletkit/pulls/683/reviews returns exactly one review: copilot-pull-request-reviewer[bot], state COMMENTED, commit_id 29663bd..., submitted 2026-11-18T14:49:41Z, body recommends approval with no open issues. A repository-wide review-comment scan confirms coderabbitai[bot] has historically reviewed (67 comments) but has no review, review comment, or issue comment on PR #683. Branch reviewDecision is REVIEW_REQUIRED and human review requests (Guardiola31337, danielle-tfh, wld-walletkit-bot) are outstanding. Copilot coverage of the current head is present and appropriately shallow for this small, focused change, but CodeRabbit coverage is entirely absent, so required coverage is incomplete. The author's self-reported local validation is not a substitute for the required reviews.

Discussion resolution

There are no review discussions: 0 review threads (GraphQL, including any resolved/outdated), 0 review comments, and no substantive issue comments other than the prior auto-approval report, which gate.py excludes. The single live Copilot review reports no findings ('No open issues'). With no findings raised there is nothing to prove fixed; conversely there is no CodeRabbit review history to rely on. Nothing was left unresolved, but the absence of CodeRabbit discussion is itself part of the missing coverage.

Independent review

I fetched pr683 (29663bd) and reviewed the full diff against base 5ab6822 plus surrounding code. CheckedRegistration::approve now returns ApproverError::VaultTooLarge when vault.len() > MAX_VAULT_SIZE, before take(&self.channel)?, so the response channel is not consumed and no InsertAuthenticator is submitted; a retry or abort remains possible. The vault is still wrapped in Zeroizing before the size check, so rejected bytes are zeroized on drop. The boundary is strict >, so a vault exactly at MAX_VAULT_SIZE remains valid, and the pre-existing MAX_RESPONSE_SIZE = MAX_VAULT_SIZE + 4 KiB budget check in register still guards the encoded response. ApprovalOutcome.vault_omitted is removed from types.rs and the one integration assertion; a repo-wide search found no remaining stale Rust, Kotlin, Swift, TypeScript, or generated-binding references (only docs text noting its absence). The new ApproverError unit variant is additive for UniFFI. Tests cover oversize rejection for both Insert and AlreadyRegistered plans, session retention (abort succeeds once, then AlreadyHandled), and successful approval at None and exact-limit sizes after an oversize error. docs/accounts.md and the module docs match the code. Minor, non-blocking nuance: the size check precedes channel acquisition, so a second approve call on an already-handled session that supplies an oversize vault returns VaultTooLarge instead of AlreadyHandled; the session is untouched in both cases and the documented retry semantics hold. I did not run the build or tests.

Repository policy

Not met. .code-review.md (base-commit blob 80cd67e...) requires (1) completed CodeRabbit and Copilot reviews covering the current changes, (2) all findings and discussions addressed, and (3) my own review, withholding on insufficient evidence. Condition (1) fails: CodeRabbit has no coverage of 29663bd. Condition (2) is vacuous (no threads). Condition (3) passes on my read, but my own review cannot substitute for the required reviewer coverage. No dependency updates are present, so the dependency-specific provenance rules do not apply. Additionally, the prepared evidence has zero reviews while live state has a Copilot review, so the evidence fingerprint changed after prepare and the approve job's fingerprint recheck would withhold even a positive verdict. Approval must wait until CodeRabbit completes a review of the current head and any findings are substantively addressed; re-run all jobs afterward.
verdict.json
{
  "head": "29663bd659b63696e9385dd959dbdf25f68c2c90",
  "evidence": "fb4a00d31707481a17b2455c2ba5d0f45fe39c6533d8b730b27422af79406f35",
  "approve": false,
  "reason": "Withholding approval. The base-commit policy .code-review.md requires completed CodeRabbit and Copilot reviews covering the current changes. The prepared evidence contains zero reviews, zero review comments, and zero threads; the PR timeline shows only review requests and a copilot_work_started event. Live GitHub state now shows one completed Copilot review on the head SHA (state COMMENTED, 'Approval recommended', no open issues), but no CodeRabbit review exists anywhere on PR #683. CodeRabbit is a real reviewer in this repository (67 historical review comments), so its absence is a genuine coverage gap, not a naming artifact. Because CodeRabbit coverage is missing, the policy condition is unmet. Independently, the prepared evidence predates the Copilot review, so the evidence fingerprint has already changed and the approval gate would reject a positive verdict as 'evidence changed'. No dependency updates are involved.",
  "review_coverage": "Prepared evidence.json (fingerprint fb4a00d3...) has reviews=[], comments=[], threads=[]. Live gh api repos/worldcoin/walletkit/pulls/683/reviews returns exactly one review: copilot-pull-request-reviewer[bot], state COMMENTED, commit_id 29663bd..., submitted 2026-11-18T14:49:41Z, body recommends approval with no open issues. A repository-wide review-comment scan confirms coderabbitai[bot] has historically reviewed (67 comments) but has no review, review comment, or issue comment on PR #683. Branch reviewDecision is REVIEW_REQUIRED and human review requests (Guardiola31337, danielle-tfh, wld-walletkit-bot) are outstanding. Copilot coverage of the current head is present and appropriately shallow for this small, focused change, but CodeRabbit coverage is entirely absent, so required coverage is incomplete. The author's self-reported local validation is not a substitute for the required reviews.",
  "discussion_resolution": "There are no review discussions: 0 review threads (GraphQL, including any resolved/outdated), 0 review comments, and no substantive issue comments other than the prior auto-approval report, which gate.py excludes. The single live Copilot review reports no findings ('No open issues'). With no findings raised there is nothing to prove fixed; conversely there is no CodeRabbit review history to rely on. Nothing was left unresolved, but the absence of CodeRabbit discussion is itself part of the missing coverage.",
  "independent_review": "I fetched pr683 (29663bd) and reviewed the full diff against base 5ab6822 plus surrounding code. CheckedRegistration::approve now returns ApproverError::VaultTooLarge when vault.len() > MAX_VAULT_SIZE, before take(&self.channel)?, so the response channel is not consumed and no InsertAuthenticator is submitted; a retry or abort remains possible. The vault is still wrapped in Zeroizing before the size check, so rejected bytes are zeroized on drop. The boundary is strict >, so a vault exactly at MAX_VAULT_SIZE remains valid, and the pre-existing MAX_RESPONSE_SIZE = MAX_VAULT_SIZE + 4 KiB budget check in register still guards the encoded response. ApprovalOutcome.vault_omitted is removed from types.rs and the one integration assertion; a repo-wide search found no remaining stale Rust, Kotlin, Swift, TypeScript, or generated-binding references (only docs text noting its absence). The new ApproverError unit variant is additive for UniFFI. Tests cover oversize rejection for both Insert and AlreadyRegistered plans, session retention (abort succeeds once, then AlreadyHandled), and successful approval at None and exact-limit sizes after an oversize error. docs/accounts.md and the module docs match the code. Minor, non-blocking nuance: the size check precedes channel acquisition, so a second approve call on an already-handled session that supplies an oversize vault returns VaultTooLarge instead of AlreadyHandled; the session is untouched in both cases and the documented retry semantics hold. I did not run the build or tests.",
  "policy_checks": "Not met. .code-review.md (base-commit blob 80cd67e...) requires (1) completed CodeRabbit and Copilot reviews covering the current changes, (2) all findings and discussions addressed, and (3) my own review, withholding on insufficient evidence. Condition (1) fails: CodeRabbit has no coverage of 29663bd. Condition (2) is vacuous (no threads). Condition (3) passes on my read, but my own review cannot substitute for the required reviewer coverage. No dependency updates are present, so the dependency-specific provenance rules do not apply. Additionally, the prepared evidence has zero reviews while live state has a Copilot review, so the evidence fingerprint changed after prepare and the approve job's fingerprint recheck would withhold even a positive verdict. Approval must wait until CodeRabbit completes a review of the current head and any findings are substantively addressed; re-run all jobs afterward."
}

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the change to explicitly reject oversized vaults while preserving the session for retry or abort.

No open issues 🎉

What changed in this PR

This PR makes WIP-109 registration reject oversized vaults explicitly rather than silently omitting them, preserving the checked session for retry or abort.

Changes:

  • Returns ApproverError::VaultTooLarge before consuming the session or submitting InsertAuthenticator.
  • Removes the public ApprovalOutcome.vault_omitted field and documents explicit vault-sharing behavior.
  • Adds regression coverage for both registration plans, abort after rejection, and retries with None or an exactly-at-limit vault.

No critical issues identified. Hosts must adapt to the breaking API change; mobile and browser runtime tests were not run locally, per the PR description.

File Description
docs/​accounts.md Documents consent, oversize rejection, and retry or abort behavior.
crates/​walletkit-core/​tests/​registration_integration.rs Removes the assertion for the deleted outcome field.
crates/​walletkit-core/​src/​registration/​types.rs Removes ApprovalOutcome.vault_omitted.
crates/​walletkit-core/​src/​registration/​mod.rs Documents the new rejection and session-preservation contract.
crates/​walletkit-core/​src/​registration/​errors.rs Adds the explicit VaultTooLarge error.
crates/​walletkit-core/​src/​registration/​approver.rs Validates vault size before session consumption and adds regression tests.

Review effort: Balanced

@Dzejkop

Dzejkop commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #698, which includes these commits and extends the check to the vault plus attachments (TransferTooLarge).

@Dzejkop Dzejkop closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants