test(resource-token): prove mint/burn reject unauthorized calls (#4)#46
Merged
elizabetheonoja-art merged 1 commit intoJun 25, 2026
Conversation
…ity-Protocol#4) The issue describes a #[requires_role] proc-macro auth bypass. No such macro (or Role enum) exists in this codebase; mint/burn are gated by authorize_mint/authorize_burn -> admin.require_auth(), which is sound and not bypassable. The real gap: every existing test uses env.mock_all_auths(), which auto-approves all authorization, so the gate is never exercised — a regression removing authorize_mint() from mint() would pass the whole suite. - test.rs: add negative-auth tests using env.set_auths(&[]) (empty auth set) proving mint and burn panic when the admin has not authorized, and that a rejected mint leaves balance and total_supply unchanged (try_mint -> Err) - docs/security/macro-auth.md: documents the actual authorization model and invariant, the scope correction (no macro exists), and a flagged follow-up: the operator-delegation path is not honored by mint/burn (admin-only), whose proper fix needs a breaking caller-Address signature change No contract behaviour changes; this hardens test coverage of the 'every mint/burn is authorized' invariant.
elizabetheonoja-art
approved these changes
Jun 25, 2026
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.
test(resource-token): prove mint/burn reject unauthorized calls
Closes #4
Changes
contracts/resource-token/src/test.rstest_mint_rejected_without_authorization—env.set_auths(&[]);mintmust panic (admin has not authorized).
test_burn_rejected_without_authorization— same, forburn.test_mint_rejected_without_auth_leaves_state_unchanged—try_mintreturns
Err, and balance + total supply remain0.contracts/docs/security/macro-auth.md— documents the real auth model andinvariant, the scope correction, and a flagged follow-up.