-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
don't allow assignment to sysvar program #7017
don't allow assignment to sysvar program #7017
Conversation
@@ -72,6 +72,12 @@ fn assign_account_to_program( | |||
return Err(InstructionError::MissingRequiredSignature); | |||
} | |||
|
|||
// guard against sysvars being assigned |
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.
this is already enforced by verify_instruction, I think...
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 you have create_account call this function so there's only one check?
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.
also: looks like the guard against changing anything about a sysvar account can be removed now
@rob-solana There isn't any sysvar related check in verify_instruction
…On Tue, Nov 19, 2019 at 1:31 AM Rob Walker ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In runtime/src/system_instruction_processor.rs
<#7017 (comment)>:
> @@ -72,6 +72,12 @@ fn assign_account_to_program(
return Err(InstructionError::MissingRequiredSignature);
}
+ // guard against sysvars being assigned
this is already enforced by verify_instruction, I think...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7017?email_source=notifications&email_token=AASLNMZOSQMWPDKBHYUIDGDQULYC3A5CNFSM4JOZD2KKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCL6VW6Y#pullrequestreview-318593915>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASLNMZDCMA7RLFQBKDSNDTQULYC3ANCNFSM4JOZD2KA>
.
--
Cheers,
Parth Desai
Polyglot software developer and architect.
|
Codecov Report
@@ Coverage Diff @@
## master #7017 +/- ##
=========================================
- Coverage 75.8% 59.8% -16.1%
=========================================
Files 223 223
Lines 44751 56739 +11988
=========================================
+ Hits 33935 33947 +12
- Misses 10816 22792 +11976 |
ah, it's above in create_system_account() ;) |
test? |
added. |
Pull request has been modified.
debug!("CreateAccount: program id {} invalid", program_id); | ||
return Err(SystemError::InvalidProgramId.into()); | ||
} | ||
|
||
if sysvar::is_sysvar_id(&to.unsigned_key()) { |
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.
this check can die, IMHO
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.
two different checks, I think. This one prevents someone to store account against any sysvar pubkey, while the other check is to prevent assignment of sysvar program to any normal account.
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.
good enough, we can consolidate duplicate checks at some point
Problem
See #7016
Summary of Changes
Don't allow changing account owner to sysvar program
Fixes #7016