Skip to content

Conversation

@joncinque
Copy link
Contributor

Problem

As described at solana-program/transfer-hook#83, there's just too many ways for signers to be potentially abused during transfer hooks.

Summary of changes

Demote all accounts to non-signer when resolving from an extra account metas list.

#### Problem

As described at solana-program/transfer-hook#83,
there's just too many ways for signers to be potentially abused during
transfer hooks.

#### Summary of changes

Demote all accounts to non-signer when resolving from an extra account
metas list.
buffalojoec
buffalojoec previously approved these changes Sep 30, 2025
Copy link
Contributor

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Lgtm. This is definitely the safer route to take.

account_info_to_meta(&account_infos[0]),
account_info_to_meta(&account_infos[1]),
account_info_to_meta(&account_infos[2]),
de_escalate_signer(account_info_to_meta(&account_infos[0])),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you just use account_info_to_meta_non_signer for all of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, nice catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it's only possible on these three, the rest are account metas already, not account infos

Comment on lines 36 to 38
// This is a little tricky to read, but the idea is to see if this account
// is marked as writable anywhere in the instruction at the start. If so,
// DON'T escalate it to be a writer in the CPI
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment incorrect? Shouldn't it say:

Check to see if the account is writable in the original instruction...

  • "If it's not, don't escalate it"
  • or: "If it's not, deescalate the extra meta is_writable config"

But just worded better than what I wrote.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes more sense, thanks!

@buffalojoec
Copy link
Contributor

Just checking - when the program is upgraded to deescalate any signers in the ExtraAccountMetaList, someone's existing transfer hook config that depends on an extra meta signer (or a rug, lol) is going to break.

Any particular plan to this upgrade and breaking behavioral change?

@joncinque
Copy link
Contributor Author

Just checking - when the program is upgraded to deescalate any signers in the ExtraAccountMetaList, someone's existing transfer hook config that depends on an extra meta signer (or a rug, lol) is going to break.

Any particular plan to this upgrade and breaking behavioral change?

From what I understand, there aren't really any uses of signers in transfer hooks, but we'll need to work with Foundation eng to get the word out -- @tiago18c can you help with that?

@joncinque joncinque merged commit 58994d7 into solana-program:main Oct 1, 2025
29 checks passed
@joncinque joncinque deleted the demoteall branch October 1, 2025 16:26
@tiago18c
Copy link

I did some digging:

  • 1 702 302 token 2022 mints
  • 58 416 using transfer hooks
  • 22 extra metas with at least 1 signer dependency
  • 1 with >0 supply
  • 0 with any transactions <365 days ago

Basically there will be no one affected (other than possible black hats).
cc: @buffalojoec @joncinque

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.

3 participants