Skip to content

Commit

Permalink
Merge pull request #123 from Squads-Protocol/fix-buffer-close-seeds
Browse files Browse the repository at this point in the history
Audit Findings: Fix transaction_buffer_close seed constraints
  • Loading branch information
0xRigel authored Sep 24, 2024
2 parents a761ea7 + bfd31d8 commit 714f71e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ pub struct TransactionBufferClose<'info> {
close = creator,
// Only the creator can close the buffer
constraint = transaction_buffer.creator == creator.key() @ MultisigError::Unauthorized,
// Account can be closed anytime by the creator, regardless of the
// current multisig transaction index
seeds = [
SEED_PREFIX,
multisig.key().as_ref(),
SEED_TRANSACTION_BUFFER,
&multisig.transaction_index.checked_add(1).unwrap().to_le_bytes(),
&transaction_buffer.transaction_index.to_le_bytes(),
],
bump
)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pub struct TransactionBufferExtend<'info> {
mut,
// Only the creator can extend the buffer
constraint = transaction_buffer.creator == creator.key() @ MultisigError::Unauthorized,
// Extending the buffer only work if it still represents the next
// transaction index in the multisig
seeds = [
SEED_PREFIX,
multisig.key().as_ref(),
Expand Down

0 comments on commit 714f71e

Please sign in to comment.