fix: close unauthenticated admin claim in set_admin - #103
Merged
EmeditWeb merged 1 commit intoAug 29, 2026
Merged
Conversation
EmeditWeb
approved these changes
Aug 29, 2026
EmeditWeb
left a comment
Member
There was a problem hiding this comment.
✅ Automated Audit: solves
@onajidavid87-web Excellent work, thank you! 🎉
The PR directly fixes the critical vulnerability in issue #80 by replacing the unauthenticated set_admin() fallback branch with an explicit initialize() function requiring admin.require_auth(), and making set_admin() fail with NotInitialized when called before initialization. All code changes, tests, and deployment updates properly address the root cause. Acceptance criteria are fully met.
CI checks: ✅ PASSED: Build and Test Contracts
Merge conflicts: ✅ none
Audited by stepfi-audit-bot 🤖
10 tasks
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.
Summary
Closes #80
This PR resolves a critical security vulnerability in
reputation-contract'sset_admin()function where an unauthenticated fallback branch allowed anyone to claim admin rights on an uninitialized contract. It introduces an explicit, single-useinitialize(env, admin)entrypoint requiringadmin.require_auth()and checkshas_adminto prevent re-initialization withAlreadyInitialized.set_admin()is updated to require existing admin authorization (old_admin.require_auth()) and fails withNotInitializedif called before initialization. Additionally, comprehensive security unit tests were added, and deployment scripts, testnet metadata, and integration test setups were updated accordingly.This repo is for Soroban smart contracts only
Before submitting, confirm your changes belong here:
contracts/directoryType of change
Testing
initialize&set_admin)Context files reviewed
Mandatory before requesting review
Running these must all exit 0:
cargo build
cargo test -p reputation-contract