Skip to content

fix(audit): N1 use auth_bump, N2 validate system_program, N3 check RP…#28

Merged
onspeedhp merged 6 commits into
mainfrom
fix/audit-n1-n2-n3
Feb 6, 2026
Merged

fix(audit): N1 use auth_bump, N2 validate system_program, N3 check RP…#28
onspeedhp merged 6 commits into
mainfrom
fix/audit-n1-n2-n3

Conversation

@onspeedhp
Copy link
Copy Markdown
Member

… ID hash

N1: Use client-provided auth_bump with create_program_address instead of
find_program_address for efficiency and proper validation

N2: Add system_program ID validation in all processors:
- create_wallet.rs
- create_session.rs
- manage_authority.rs
- transfer_ownership.rs

N3: Add explicit RP ID hash verification in Secp256r1 authenticator:
- Compute SHA256 of user-provided rp_id
- Compare against stored rp_id_hash for defense in depth

… ID hash

N1: Use client-provided auth_bump with create_program_address instead of
    find_program_address for efficiency and proper validation

N2: Add system_program ID validation in all processors:
    - create_wallet.rs
    - create_session.rs
    - manage_authority.rs
    - transfer_ownership.rs

N3: Add explicit RP ID hash verification in Secp256r1 authenticator:
    - Compute SHA256 of user-provided rp_id
    - Compare against stored rp_id_hash for defense in depth
- Completely remove sdk/ directory (temporary removal per user request)
- Add tests-e2e/src/scenarios/audit_validations.rs for N1/N2/N3 tests
- Fix all E2E tests to use correct auth_bump from find_program_address
- Fix failures.rs account order to match program expectation

Note: CreateWallet tests pass with new N1/N2 fixes. Execute tests need
separate investigation for UnsupportedProgramId error (unrelated to audit).
- Fix happy_path.rs compact instruction indices (program_id_index 0→4, accounts 1,2→5,6)
- Fix manage_authority.rs Secp256r1 space calculation (add 4-byte counter prefix)
- Fix failures.rs signing (remove owner_keypair from sign)
- All Happy Path tests now pass
- Failures scenarios 1-2 now pass
- Fix failures.rs Scenario 4 (Session Expiry): use warp_to_slot to ensure expiry
- Fix failures.rs Scenario 5 (Admin Perms): fix instruction data and account order
- Fix cross_wallet_attacks.rs: fix instruction data and signing keypairs
- Add warp_to_slot to TestContext
- All E2E tests PASS
- Replace hardcoded rent constants with Rent::minimum_balance(space) in manage_authority.rs
- Use Rent sysvar in all AddAuthority logic (program + tests)
- Update TEST_ISSUES.md
@onspeedhp onspeedhp merged commit 17cbf43 into main Feb 6, 2026
3 checks passed
@onspeedhp onspeedhp deleted the fix/audit-n1-n2-n3 branch February 6, 2026 14:17
onspeedhp added a commit that referenced this pull request Apr 7, 2026
fix(audit): N1 use auth_bump, N2 validate system_program, N3 check RP…
onspeedhp added a commit that referenced this pull request Apr 7, 2026
fix(audit): N1 use auth_bump, N2 validate system_program, N3 check RP…
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