Skip to content

Commit

Permalink
fix(execute_transaction): SQU-682 Prevent execution of internal execu…
Browse files Browse the repository at this point in the history
…te functions
  • Loading branch information
bguillaumat committed Jan 25, 2023
1 parent 7ef3ed2 commit 0947040
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions programs/squads-mpl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ pub mod squads_mpl {
if &ix.program_id != ctx.program_id {
return err!(MsError::InvalidAuthorityIndex);
}
// Prevent recursive call on execute_transaction/instruction that could create issues
let execute_transaction = Vec::from_hex("e7ad315beb184413").unwrap();
let execute_instruction = Vec::from_hex("301228284b4a936e").unwrap();
if Some(execute_transaction.as_slice()) == ix.data.get(0..8) ||
Some(execute_instruction.as_slice()) == ix.data.get(0..8) {
return err!(MsError::InvalidAuthorityIndex);
}
// since the add member may need to pay realloc, switch the payer
if Some(add_member_discriminator.as_slice()) == ix.data.get(0..8) ||
Some(add_member_and_change_threshold_discriminator.as_slice()) == ix.data.get(0..8) {
Expand Down

0 comments on commit 0947040

Please sign in to comment.