Repository navigation
fix(primitives,wdk): decode zero-permission session leaves and refuse to create them - #1072
Conversation
… to create them decodeSessionPermissions threw on a permission count of 0 although the encoder writes it and the contracts accept it, so a sessions tree holding such a leaf could no longer be decoded and every session or signer update for the wallet failed. - primitives: decode a count of 0; addExplicitSession requires a non-empty permissions array (the encoder still accepts 0 so existing trees can be re-encoded) - wdk: decode the new sessions tree in prepareSessionUpdate before saving it or requesting a signature Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tolgahan-arikan
left a comment
There was a problem hiding this comment.
Approved. Checked: zero-count decode matches SessionSig._decodePermissions in wallet-contracts-v3 (uint8 count, 0 accepted); SessionConfig.addExplicitSession rejects empty / non-array permissions and the WDK modifyExplicitSession goes through it; prepareSessionUpdate decodes the new tree before saving or signing. A tree holding an empty leaf decodes with an unchanged image hash and accepts identity-signer add and session removal (repro against 3.0.15 throws No permissions). primitives and WDK suites pass on the PR head with a local anvil fork.
decodeSessionPermissionsnow accepts a permission count of 0, matching the encoder and the contracts.SessionConfig.addExplicitSessionrequires a non-empty permissions array, and the WDK checks that a new sessions tree decodes before saving it or requesting a signature.Changes
decodeSessionPermissionsdecodes a count of 0. The encoder is unchanged.SessionConfig.addExplicitSessionrejectspermissionsthat is not a non-empty array. The WDK'saddExplicitSessionandmodifyExplicitSessionboth go through it.prepareSessionUpdatedecodes the new sessions tree before saving it or requesting a signature.Tests
sessions-empty-permissions.test.ts.🤖 Generated with Claude Code