Skip to content

fix(session-key): reject zero address in login - #1192

Open
SgtPooki wants to merge 2 commits into
masterfrom
fix/session-key-reject-zero-address
Open

SgtPooki wants to merge 2 commits into
masterfrom
fix/session-key-reject-zero-address

Conversation

@SgtPooki

@SgtPooki SgtPooki commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What

loginCall in @filoz/synapse-core/session-key now throws a ValidationError when the session key address is the zero address. Nothing is simulated or sent.

Why

The zero address is what a malformed signature recovers to, so authorizing it as a session key is never valid. This is defense in depth alongside the matching contract change in FilOzone/filecoin-services#688, which makes signature verification reject a zero-address signer.

Covered entry points

  • loginCall: holds the check
  • login: builds its request with loginCall
  • loginSync: calls login

These are the only places in the monorepo that build a SessionKeyRegistry.login call. secp256k1.ts derives the session key address from a private key and does not authorize anything, so it is unchanged.

The JSON-RPC test mocks gain a sessionKeyRegistry.login handler so login can be tested against the mocked RPC.

Verification

  • pnpm run lint: pass
  • pnpm run build: pass
  • pnpm turbo run test --filter=@filoz/synapse-core: pass (node and browser)
  • pnpm turbo run test --filter=@filoz/synapse-sdk: pass (node and browser)
  • New test/login.test.ts: loginCall, login and loginSync throw for the zero address, login and loginSync with no RPC request made; login with a normal address still returns a transaction hash. The zero-address tests failed before the check was added.

@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Dec 1, 2026
@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

filecoin-encryption-envelope

npm i https://pkg.pr.new/filecoin-encryption-envelope@1192

@filoz/keysmith

npm i https://pkg.pr.new/@filoz/keysmith@1192

@filoz/synapse-core

npm i https://pkg.pr.new/@filoz/synapse-core@1192

@filoz/synapse-react

npm i https://pkg.pr.new/@filoz/synapse-react@1192

@filoz/synapse-sdk

npm i https://pkg.pr.new/@filoz/synapse-sdk@1192

commit: e20c5de

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview: https://pr-1192-synapse-dev.filoz.workers.dev

Built from e20c5de.

@SgtPooki SgtPooki self-assigned this Dec 1, 2026

@SgtPooki SgtPooki left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

self review

@pullfrog pullfrog Bot 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.

ℹ️ The zero-address guard works as intended. One non-blocking suggestion inline.

Approach: Sound — validating in loginCall covers direct call construction, login, and loginSync before any RPC request.

Reviewed changes in the session-key actions, JSON-RPC mocks, and regression tests.

  • Login validation: loginCall throws a ValidationError for the zero address and exposes it through all three actions’ error types.
  • Mocks and coverage: The mock registry supports login. The tests cover a valid login and confirm that both write actions reject the zero address without issuing an RPC request.
  • Verification: All five focused tests passed in Node.js and Chromium. The synapse-core build and lint also passed.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol | 𝕏

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes in e20c5de since the prior Pullfrog review:

  • Narrowed the guard to a direct comparison with zeroAddress. The zero address still fails before any RPC request, and viem’s ABI encoder still handles other address validation.
  • Added a regression test confirming that loginCall leaves a malformed nonzero address unchanged in the call arguments.

All six focused login tests passed in Node.js and Chromium. The synapse-core build and lint also passed.

Pullfrog  | View workflow run | Using gpt-6.2-sol | 𝕏

@FilOzzy FilOzzy moved this from 📌 Triage to 🔎 Awaiting review in FOC Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant