Skip to content

v2.2: Fix - Invoke non program account owned by a builtin (backport of #5158)#5207

Merged
Lichtso merged 1 commit into
v2.2from
mergify/bp/v2.2/pr-5158
Mar 28, 2025
Merged

v2.2: Fix - Invoke non program account owned by a builtin (backport of #5158)#5207
Lichtso merged 1 commit into
v2.2from
mergify/bp/v2.2/pr-5158

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented Mar 10, 2025

Problem

Currently there is a slight bug once remove_accounts_executable_flag_checks is active:
One can invoke a built-in program by invoking any account owned by it instead. This leads to the built-in running as a different pubkey, thus all ownership checks fail and the built-in has no write access to anything.

This is benign as it only allows invoking built-in programs in a strange nonsensical way. But, it is still a stupid thing to support and would hinder future protocol changes such as these in the account loader.

About rekeying: Well see Discord discussion.

Summary of Changes

Blocks the execution of any non loader owned or non built-in account and adds test_invoke_non_program_account_owned_by_a_builtin() to demonstrate the change in behavior.

Feature Gate Issue: https://github.com/anza-xyz/feature-gate-tracker/issues/69


This is an automatic backport of pull request #5158 done by Mergify.

@mergify mergify Bot requested a review from a team as a code owner March 10, 2025 12:26
@Lichtso Lichtso requested a review from LucasSte March 10, 2025 13:09
LucasSte
LucasSte previously approved these changes Mar 10, 2025
@Lichtso Lichtso force-pushed the mergify/bp/v2.2/pr-5158 branch from 3fcf6fa to 98a759a Compare March 11, 2025 14:57
@t-nelson
Copy link
Copy Markdown

hold on figuring out where/how to rekey

* Adds test_invoke_non_program_account_owned_by_a_builtin().

* Throws InstructionError::UnsupportedProgramId when invoking any non loader owned or non built-in account.

(cherry picked from commit 9adbffc)
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.3%. Comparing base (bf03df9) to head (b7f36c7).
⚠️ Report is 124 commits behind head on v2.2.

Additional details and impacted files
@@            Coverage Diff            @@
##             v2.2    #5207     +/-   ##
=========================================
- Coverage    83.3%    83.3%   -0.1%     
=========================================
  Files         800      800             
  Lines      370170   370217     +47     
=========================================
+ Hits       308493   308509     +16     
- Misses      61677    61708     +31     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jstarry
Copy link
Copy Markdown

jstarry commented Mar 25, 2025

Can't land this until we switch over the feature set from solana-feature-set to agave-feature-set
https://discord.com/channels/428295358100013066/910937142182682656/1354182908335620116
cc @t-nelson

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.

5 participants