fix: add missing verify_token_program in AdminWithdrawInsurance - #99
Conversation
process_admin_withdraw_insurance passes token_program through to a CPI (cpi_withdraw_insurance_limited) without first verifying it is the real SPL Token program. Every other CPI-invoking handler in the codebase (InitPool, Deposit, Withdraw, DepositJunior) calls verify_token_program before use. Without this check, an attacker could substitute a malicious program, potentially draining the insurance vault during the CPI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA security validation check is added to Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Sentinel security review — MERGE Fix is correct and necessary. Current master at Diff is minimal and surgical — 4 lines added, no behaviour change on the happy path. No conflicts with batch-2 (PR #98 already merged). No new findings introduced by this PR. Severity confirmed: CRITICAL (CPI with PDA signer, no token program validation, direct fund movement). CVSS ~9.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N). findings: none introduced — pure fix |
Summary
process_admin_withdraw_insurancepassestoken_programthrough tocpi_withdraw_insurance_limitedwithout callingverify_token_program()firstInitPool,Deposit,Withdraw,DepositJunior) validates the token program before useSeverity
CRITICAL — missing token program verification on a CPI that moves funds
Fix
Added
verify_token_program(token_program)?;before the vault_auth PDA derivation, consistent with all other handlers.Test plan
cargo build— compiles cleanlycargo clippy— zero warnings🤖 Generated with Claude Code
Summary by CodeRabbit