Skip to content

[SEC] Implement Authorization Signatures for Admin Actions #20

Description

@Queenode

🔴 Priority: Critical
Difficulty: Hard
Estimated Effort: 2-3 days
Relevant Files: contracts/src/lib.rs
Labels: security, priority:critical, auth

Requirements

  1. Explicit Auth Verification

    • The current contract uses admin.require_auth(); for sensitive actions. While Soroban's auth framework handles the signature verification, it's best practice to explicitly verify that the auth covers the exact arguments passed to the function to prevent replay or argument spoofing if the contract is used as a sub-call.
  2. Refactor Write Operations

    • For add_member: ensure the auth signature specifically covers (env.current_contract_address(), Symbol::new(&env, "add_member"), (new_member,)).
    • For payout: ensure auth covers the recipient argument.
    • For reset_cycle: ensure auth covers the cycle reset action.
    • For remove_member (from Issue [Deployment] Create Scripts for Testnet Deployment #2): ensure auth covers the specific member being removed.
  3. Multi-Sig Preparation

    • Ensure the contract does not assume the Admin is a single ed25519 keypair. The Admin address might be a multisig account or another smart contract.
    • Use env.authorize_as_curr_contract() where applicable if the contract needs to perform cross-contract calls on behalf of the admin.
  4. Testing

    • Utilize env.mock_auths() in tests to strictly define the expected authorization payload.
    • Test that calling payout(recipient_A) with an authorization signature meant for payout(recipient_B) fails.
    • Target: Strict auth checks verified in all state-modifying tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions