Skip to content
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

Treasury Audit Fixes #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Treasury Audit Fixes #46

wants to merge 1 commit into from

Conversation

Peartes
Copy link
Contributor

@Peartes Peartes commented Dec 17, 2024

Enhance contract security with address validation, two-step ownership transfer, and key existence checks

Description

This commit improves the security and robustness of the contract by addressing several issues identified during the audit and implementing recommended changes:

Changes

1. Address Validation for Admin Updates

  • Added validation using deps.api.addr_validate() to ensure the new_admin address has the correct format before storing it.
  • Prevents invalid or unchecked addresses from being set as the admin.

2. Two-Step Ownership Transfer

  • Implemented a two-step process to safely update the admin address:
    • propose_admin: The current admin proposes a new admin.
    • accept_admin: The proposed admin accepts ownership.
    • cancel_proposed_admin: The current admin can cancel a pending transfer.
  • Ensures ownership cannot be accidentally transferred to an invalid or unintended address.

3. Key Existence Validation for Removals

  • Added has() checks before removing entries:
    • remove_auth_method: Checks the key exists in AUTHENTICATORS before removal.
    • remove_grant_config: Checks the key exists in GRANT_CONFIGS before removal.
  • Returns a NotFound error if the key does not exist, preventing misleading operations.

@Peartes Peartes requested a review from ash-burnt December 17, 2024 17:11
@ash-burnt ash-burnt changed the title feat: merge main Treasury Audit Fixes Dec 20, 2024
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.

1 participant