Skip to content

fix(cli): validate deploy program id keypair match#4694

Open
fallintoplace wants to merge 1 commit into
otter-sec:masterfrom
fallintoplace:fix/program-id-keypair-assertion
Open

fix(cli): validate deploy program id keypair match#4694
fallintoplace wants to merge 1 commit into
otter-sec:masterfrom
fallintoplace:fix/program-id-keypair-assertion

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • Treat --program-id as an assertion when anchor program deploy also receives --program-keypair.
  • Reject mismatched values before RPC, wallet, or deployment work starts.
  • Keep the existing explicit error for --program-id without --program-keypair and add focused tests for both cases.

Why

The native deploy path loaded the requested program keypair and then unconditionally used that keypair pubkey as the target program ID. That meant a command with --program-id X --program-keypair Y silently targeted Y, even if the user was expecting X.

Validation

  • cargo fmt --package anchor-cli
  • cargo test -p anchor-cli program_id
  • cargo test -p anchor-cli program::tests::

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

@fallintoplace is attempting to deploy a commit to the OtterSec Team on Vercel.

A member of the Team first needs to authorize it.

0x4ka5h
0x4ka5h previously approved these changes Jun 22, 2026

@0x4ka5h 0x4ka5h left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, fixes a real deploy correctness bug

@jamie-osec jamie-osec added enhancement New feature or request cli labels Jun 22, 2026
Comment thread cli/src/program.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants