Skip to content

fix(primitives,wdk): decode zero-permission session leaves and refuse to create them - #1072

Merged
shan8851 merged 1 commit into
masterfrom
fix/empty-session-permissions
Nov 26, 2026
Merged

shan8851 merged 1 commit into
masterfrom
fix/empty-session-permissions

Conversation

@shan8851

@shan8851 shan8851 commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

decodeSessionPermissions now accepts a permission count of 0, matching the encoder and the contracts. SessionConfig.addExplicitSession requires a non-empty permissions array, and the WDK checks that a new sessions tree decodes before saving it or requesting a signature.

Changes

  • primitives: decodeSessionPermissions decodes a count of 0. The encoder is unchanged.
  • primitives: SessionConfig.addExplicitSession rejects permissions that is not a non-empty array. The WDK's addExplicitSession and modifyExplicitSession both go through it.
  • wdk: prepareSessionUpdate decodes the new sessions tree before saving it or requesting a signature.

Tests

  • primitives: zero-permission leaves round-trip through encode and decode; empty and non-array permissions are rejected.
  • wdk: new sessions-empty-permissions.test.ts.
  • Full suites for primitives, core and wdk pass on Node 22.

🤖 Generated with Claude Code

… 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>
@shan8851
shan8851 marked this pull request as ready for review November 26, 2026 11:08
@shan8851
shan8851 requested a review from a team November 26, 2026 11:08
@shan8851
shan8851 requested a review from a team as a code owner November 26, 2026 11:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T11:10:13.840970Z b4e05e2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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 tolgahan-arikan 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.

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.

@shan8851
shan8851 merged commit 1be910a into master Nov 26, 2026
11 checks passed
@shan8851
shan8851 deleted the fix/empty-session-permissions branch November 26, 2026 12:18
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.

2 participants