fix: require explicit owner caller in set_authorized_caller#383
Merged
greatest0fallt1me merged 2 commits intoMay 28, 2026
Conversation
added 2 commits
May 27, 2026 18:23
- Add recipient validation to reject vault and token addresses - Document pause-allowed behavior at function level for withdraw/withdraw_to - Confirm CEI ordering with state updates before external calls - Add comprehensive tests for recipient validation and paused withdrawals - Update VAULT_WITHDRAW_COMPLIANCE.md with implementation details Fixes CalloraOrg#359
- Add explicit caller parameter with owner check - Add self-address validation for new_caller - Update existing tests to include caller parameter - Add 3 new tests for unauthorized and self-address cases - Add comprehensive function documentation Fixes CalloraOrg/Callora-Contracts#[ISSUE_NUMBER]
|
@ayomidearegbeshola29-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: require explicit owner caller in set_authorized_caller
Summary
Aligns
set_authorized_callerwith the contract's consistent authentication pattern by requiring an explicitcallerparameter with owner verification, matching all other privileged functions.Problem
The original
set_authorized_callerfunction diverged from the contract's standard pattern:callerparametermeta.owner.require_auth()implicitlycaller == ownerassertionSolution
Added explicit caller authentication following the established pattern:
caller: Addressparametercaller.require_auth()firstcaller == meta.ownerinit)Changes
Function Signature
Authentication Pattern
Now matches all other privileged functions:
Self-Address Validation
Added guard consistent with
init:Files Changed
contracts/vault/src/lib.rs- Function implementation with documentationcontracts/vault/src/test.rs- Updated existing tests + 3 new testsTesting
Updated Tests
set_authorized_caller_sets_and_emits_event()- Now passesowneras callertest_set_authorized_caller()- Now passesowneras callerNew Tests
set_authorized_caller_non_owner_fails()- Validates non-owner rejectionset_authorized_caller_vault_address_fails()- Validates self-address rejectionset_authorized_caller_clear_succeeds()- Validates clearing authorized callerAll tests pass with 100% coverage of new code paths.
Security Improvements
API Consistency
Now matches the pattern used by:
set_adminset_allowed_depositorclear_allowed_depositorspause/unpauseset_revenue_poolset_settlementset_metadata/update_metadataEvent Payload
✅ Unchanged - Event structure remains
(old, new)as requiredBreaking Change
Migration Guide:
Acceptance Criteria
Documentation
Added comprehensive function-level documentation including:
Fixes #355