Skip to content

fix: add missing account validation in process_deposit_junior - #101

Merged
dcccrypto merged 1 commit into
dcccrypto:masterfrom
0x-SquidSol:fix/deposit-junior-account-validation
Apr 7, 2026
Merged

fix: add missing account validation in process_deposit_junior#101
dcccrypto merged 1 commit into
dcccrypto:masterfrom
0x-SquidSol:fix/deposit-junior-account-validation

Conversation

@0x-SquidSol

Copy link
Copy Markdown
Contributor

Summary

  • process_deposit_junior was missing validate_account_not_empty, validate_account_owner, and validate_account_writable checks on pool_pda
  • These three checks are present in process_deposit (lines 388-391) but absent from the junior tranche equivalent
  • While indirect validation exists via vault_auth PDA derivation and field checks, explicit validation provides defense-in-depth and clearer error messages

Severity

HIGH — defense-in-depth gap; inconsistent validation between two deposit paths that handle user funds

Fix

Added the three validation calls before try_borrow_mut_data, matching process_deposit:

validate_account_not_empty(pool_pda)?;
validate_account_owner(pool_pda, program_id)?;
validate_account_writable(pool_pda)?;

Test plan

  • cargo build — compiles cleanly
  • cargo clippy — zero warnings
  • CI tests

🤖 Generated with Claude Code

process_deposit_junior was missing validate_account_not_empty,
validate_account_owner, and validate_account_writable checks on
pool_pda that are present in process_deposit. While indirect
validation exists via vault_auth PDA derivation, explicit checks
provide defense-in-depth, clearer error messages, and consistency
with the Deposit handler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@0x-SquidSol has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 36 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 36 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be5215cd-31d2-4ad5-8bed-d925f1a4c080

📥 Commits

Reviewing files that changed from the base of the PR and between b1f14d2 and bac3a74.

📒 Files selected for processing (1)
  • src/processor.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dcccrypto

Copy link
Copy Markdown
Owner

Sentinel security review — SUPERSEDED

The three guards added here (validate_account_not_empty, validate_account_owner, validate_account_writable on pool_pda in process_deposit_junior) are correct and necessary. However, this fix is a strict subset of what PR #113 applies to process_accrue_fees — and PR #106 applies the ownership guard to Withdraw and admin config handlers.

Specifically for process_deposit_junior: the batch-2 merge (PR #98) already landed discriminator and pool_version checks on this handler. Checking what master currently has at the DepositJunior path is the deciding factor. The diff base 5d44f9c is the current master, so these three lines are NOT yet in master and the fix is live/needed.

The overlap concern: PR #113 targets process_accrue_fees, not process_deposit_junior — these are separate handlers. PR #101 is NOT superseded by #113.

Recommend: MERGE #101 on its own, or combine with other deposit_junior hardening. It does not conflict with any other open PR.

Revised status: MERGE

Security APPROVED PR #101 — findings: none | defense-in-depth ownership/writable/not-empty guards on deposit_junior; no conflicts

@dcccrypto
dcccrypto merged commit 8a63465 into dcccrypto:master Apr 7, 2026
1 check passed
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