Overview
The UMA CTF Adapter implements a simple yet effective access control system through theAuth mixin contract. This system manages admin privileges required for administrative functions like flagging, manual resolution, and emergency procedures.
Auth Mixin
TheAuth abstract contract provides the foundation for access control.
Location
src/mixins/Auth.sol
Storage
admins[address] = 1indicates the address is an adminadmins[address] = 0indicates the address is not an admin (or has been removed)
Modifier
onlyAdmin modifier restricts function access to addresses with admin privileges.
Constructor Behavior
Add Admin
Grants admin privileges to a new address.Function Signature
Parameters
admin- The address to grant admin privileges
Behavior
- Sets
admins[admin] = 1 - Emits
NewAdmin(msg.sender, admin)event
Requirements
- Caller must be an existing admin
Use Cases
- Expanding admin team for operational scaling
- Adding multi-signature wallet as admin
- Granting admin rights to governance contracts
- Decentralizing administrative control
Example
Security Considerations
- Verify addresses carefully: Incorrect addresses cannot be easily corrected
- Use multi-sig wallets: Consider making the new admin a multi-signature wallet
- Document admin additions: Maintain records of who was added and why
- Principle of least privilege: Only add admins when necessary
Remove Admin
Revokes admin privileges from an address.Function Signature
Parameters
admin- The address to revoke admin privileges from
Behavior
- Sets
admins[admin] = 0 - Emits
RemovedAdmin(msg.sender, admin)event
Requirements
- Caller must be an existing admin
Use Cases
- Removing compromised admin accounts
- Rotating admin keys for security
- Removing admins who no longer require access
- Responding to governance decisions
Example
Security Considerations
- Maintain at least one admin: Be careful not to remove all admins
- Verify the address: Ensure you’re removing the intended admin
- Coordinate with team: Communicate admin removals to prevent operational disruption
- Emergency procedures: Have a recovery plan if the wrong admin is removed
Renounce Admin
Allows an admin to voluntarily renounce their own admin privileges.Function Signature
Behavior
- Sets
admins[msg.sender] = 0 - Emits
RemovedAdmin(msg.sender, msg.sender)event
Requirements
- Caller must be an existing admin
Use Cases
- Rotating admin responsibilities
- Transitioning to new admin accounts
- Reducing admin surface area
- Voluntary step-down from admin role
Example
Security Considerations
- Ensure backup admins exist: Don’t renounce if you’re the last admin
- Irreversible without other admins: You cannot re-add yourself without another admin
- Coordinate with team: Ensure someone else can handle admin duties
- Use with caution: This action cannot be undone by the renouncing admin
Is Admin (View Function)
Checks if an address has admin privileges.Function Signature
Parameters
addr- The address to check
Returns
trueif the address is an admin (admins[addr] == 1)falseotherwise
Use Cases
- Frontend authorization checks
- Verification before admin operations
- Auditing admin status
- Integration with governance systems
Example
Admin Management Best Practices
Multi-Signature Wallets
For production deployments:Admin Rotation
Rotating admin keys for security:Governance Integration
Transitioning to governance-controlled admin:Emergency Admin Addition
In case all admins lose access:- Problem: No admin recovery mechanism exists in the contract
- Prevention: Always maintain multiple admins
- Recommendation: Use multi-signature wallets with backup signers
- Last resort: Contract upgrade or redeployment may be necessary
Access Control Flow
Admin-Protected Functions
The following functions requireonlyAdmin access:
flag(bytes32 questionID)unflag(bytes32 questionID)reset(bytes32 questionID)resolveManually(bytes32 questionID, uint256[] calldata payouts)pause(bytes32 questionID)unpause(bytes32 questionID)addAdmin(address admin)removeAdmin(address admin)renounceAdmin()
Access Control Check
Events
The Auth contract emits events for all admin changes:NewAdmin
addedBy- The admin who added the new adminnewAdmin- The address granted admin privileges
RemovedAdmin
removedBy- The admin who removed the admin (or self for renounce)admin- The address that lost admin privileges
Security Considerations
Critical Admin Responsibilities
Admins have significant power and should:- Protect private keys: Use hardware wallets for admin accounts
- Use multi-signature: Require multiple approvals for sensitive operations
- Monitor admin activity: Watch for unauthorized admin changes
- Document all actions: Maintain audit trail of admin operations
- Follow governance: Adhere to established governance procedures
Attack Vectors
Compromised Admin Key- An attacker with admin access can:
- Manually resolve questions with arbitrary payouts (after flagging + safety period)
- Pause/unpause questions
- Add/remove other admins
- Mitigation: Use multi-signature wallets, key rotation, monitoring
- Losing all admin keys means:
- No manual intervention possible
- Cannot handle emergency situations
- May need contract upgrade or redeployment
- Mitigation: Multiple admin backups, multi-sig with backup signers
- A malicious admin could:
- Flag and manually resolve questions incorrectly (after safety period)
- Remove other admins (if not using multi-sig)
- Pause legitimate questions
- Mitigation: Governance oversight, time delays, multi-sig requirements
Recommendations
- Never use EOA as sole admin in production: Always use multi-signature wallets
- Maintain 3+ admins: Redundancy protects against key loss
- Implement governance: Use DAO or governance contract for admin decisions
- Monitor on-chain events: Watch for unexpected admin changes
- Regular security audits: Review admin actions and access control
- Document procedures: Clear guidelines for admin operations
- Key rotation policy: Regularly rotate admin keys for security