Skip to content

[confidential-transfer-fee] Add check_program_account in confidential transfer fee for early termination and better error message#764

Merged
samkim-crypto merged 2 commits intosolana-program:mainfrom
samkim-crypto:check-program-account
Oct 6, 2025
Merged

[confidential-transfer-fee] Add check_program_account in confidential transfer fee for early termination and better error message#764
samkim-crypto merged 2 commits intosolana-program:mainfrom
samkim-crypto:check-program-account

Conversation

@samkim-crypto
Copy link
Copy Markdown
Contributor

@samkim-crypto samkim-crypto commented Oct 4, 2025

Addressing the following audit report:

L-02: Missing check_program_account before unpack/mutate (pattern across multiple call sites)

Location(s):

program/src/extension/confidential_transfer_fee/processor.rs:#L182-L221 (destination account)
program/src/extension/confidential_transfer_fee/processor.rs:#L326-L341 (mint in harvest-to-mint)

Impact (why this matters): Fails late with less clear errors when non–Token-2022 accounts are supplied; adds compute and reduces observability. No privilege escalation or funds loss; failure is confined to the current transaction.

Description (root cause): Unpack/mutate without first calling check_program_account(..).

Remediation: Insert check_program_account(owner)? before unpack/mutation.

@samkim-crypto samkim-crypto marked this pull request as ready for review October 6, 2025 03:21
buffalojoec
buffalojoec previously approved these changes Oct 6, 2025
&account_infos[..num_signers],
)?;

check_program_account(destination_account_info.owner)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you want, you could also add this up on line 115 under process_withdraw_withheld_tokens_from_mint, for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh good point! Just added.

@samkim-crypto samkim-crypto merged commit 6b100ba into solana-program:main Oct 6, 2025
33 checks 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