program-runtime: harden native_invoke to take signer seeds#10681
program-runtime: harden native_invoke to take signer seeds#10681buffalojoec merged 3 commits intoanza-xyz:masterfrom
Conversation
|
The Firedancer team maintains a line-for-line reimplementation of the |
52b8dfc to
c1f601c
Compare
|
If this PR represents a change to the public RPC API:
Thank you for keeping the RPC clients in sync with the server API @buffalojoec. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #10681 +/- ##
========================================
Coverage 83.0% 83.0%
========================================
Files 849 849
Lines 318240 318329 +89
========================================
+ Hits 264335 264453 +118
+ Misses 53905 53876 -29 🚀 New features to boost your workflow:
|
c1f601c to
107c61b
Compare
|
r+ sme. @Lichtso looks like this was introduced by a change you made ages ago, can you review? |
107c61b to
ff2cfdf
Compare
Problem
native_invoketakessigners: &[Pubkey], letting any builtin silently vouch for arbitrary addresses as CPI signers. This is a dangerous footgun for anyone who assumesnative_invokebuiltin CPI dispatch is safe likeinvoke_signedis for SBPF.This function originally accepted PDA seeds and performed CPI signer validation internally, rather than leaving it up to the caller.
https://github.com/solana-labs/solana/blob/9e90394583b7791b6d7b3b5e6623c598579078b3/runtime/src/message_processor.rs#L593-L599
Subsequent refactoring changed this to accept a slice of public keys and shifted the onus for CPI signer validation onto the caller program.
PR | Diff | File view
CPI dispatch for builtin programs should not deviate from SBPF dispatch and put the signer onus on the caller programs, but instead should match SBPF CPI dispatch.
Summary of Changes
Return to the original argument for accepting PDA seeds and add documentation, so it's crystal clear what this function is for and how to use it.
Also adds a lot of tests.