Skip to content

fix: backup keys are on the secp256k1 curve#193

Merged
paolodamico merged 4 commits into
mainfrom
reset-k256
Mar 13, 2026
Merged

fix: backup keys are on the secp256k1 curve#193
paolodamico merged 4 commits into
mainfrom
reset-k256

Conversation

@paolodamico

@paolodamico paolodamico commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

The backend was incorrectly verifying backup account keys on the P256 curve. See https://github.com/worldcoin/bedrock/blob/d15b20a65d452cc974b45d17c0f1f753921bfb4b/bedrock/src/root_key/mod.rs#L210


Note

Medium Risk
Changes cryptographic signature verification for the reset flow from p256 to k256 (secp256k1), which can affect account recovery behavior if key parsing/signature validation differs.

Overview
Fixes reset signature verification to match backup key curve. The reset route now parses backup_account_id public keys and verifies signatures using k256/secp256k1 rather than p256.

Workspace dependencies were updated to add k256 (and adjust p256 features), and unit/integration tests for reset were updated to generate/sign with secp256k1 keys (including a dedicated helper for backup-key challenge signing).

Written by Cursor Bugbot for commit 407ff6b. This will update automatically on new commits. Configure here.

Comment thread src/routes/reset.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread tests/reset_backup_integration.rs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes the reset/backup recovery flow to verify backup_account_id signatures on the correct curve (secp256k1), aligning backend behavior with how backup keys are generated and represented.

Changes:

  • Switch reset signature verification from p256 to k256 (secp256k1) when parsing backup_account_id compressed public keys.
  • Update reset unit + integration tests to generate and sign challenges with secp256k1 backup keys.
  • Update workspace dependencies to include k256 (and adjust p256 features).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/routes/reset.rs Uses k256 to parse compressed backup_account_id public keys and verify ECDSA signatures on secp256k1.
tests/reset_backup_integration.rs Updates reset integration tests to derive backup_account_id and sign challenges using secp256k1 backup keys.
Cargo.toml Adds k256 dependency and adjusts p256 features in the workspace.
Cargo.lock Locks k256 and its transitive dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/routes/reset.rs
@paolodamico paolodamico merged commit 086391c into main Mar 13, 2026
16 checks passed
@paolodamico paolodamico deleted the reset-k256 branch March 13, 2026 21:09
@github-actions github-actions Bot mentioned this pull request Mar 13, 2026
@github-actions github-actions Bot mentioned this pull request May 26, 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