-
Notifications
You must be signed in to change notification settings - Fork 15
tlv-account-resolution: Always demote signer flag #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
#### 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
left a comment
There was a problem hiding this 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.
tlv-account-resolution/src/state.rs
Outdated
| 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])), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, nice catch!
There was a problem hiding this comment.
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
tlv-account-resolution/src/state.rs
Outdated
| // 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 |
There was a problem hiding this comment.
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_writableconfig"
But just worded better than what I wrote.
There was a problem hiding this comment.
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!
|
Just checking - when the program is upgraded to deescalate any signers in the 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? |
|
I did some digging:
Basically there will be no one affected (other than possible black hats). |
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.