feat(rbac): reject duplicate role grants, validate roles, and add dependency check (#761 #768 #770) - #866
Open
nekwasar wants to merge 1 commit into
Open
Conversation
…endency check (BCPathway#761 BCPathway#768 BCPathway#770) - BCPathway#768: add RoleAlreadyGranted (21) error; grant_role now fails loudly when the target already holds the role instead of silently no-oping - BCPathway#761: lock in role-bound validation with tests for every recognized role and its bitmask bit - BCPathway#770: add scripts/check_crate_cycles.py and wire it into CI to catch circular workspace crate dependencies; verify token->admin isolation - update fuzz and error-name tests for the new variant and behavior
|
@nekwasar 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.
Closes #761, Closes #768, Closes #770
#768 — Cannot grant already granted role (idempotency)
AdminError::RoleAlreadyGranted(discriminant 21).grant_role/_grant_rolenow fail loudly when the target already holds the role, instead of silently OR-ing the bitmask.fuzz_grant_role_already_granted,test_grant_role_already_granted_fails, and the self-grant fuzz) to assert the new behavior.#761 — Parameter validation for grant_role(role)
test_grant_role_accepts_every_recognized_role, asserting each recognized role is granted end-to-end and maps to exactly its power-of-two bitmask bit. (The publicRoletype is a#[contracttype]enum, so unknown discriminants are excluded at the type level;require_valid_roleremains as defense in depth.)#769 — Lifecycle modifiers use RBAC
contracts/lifecyclealready usesadmin::require_role(Pauser)/admin::require_pauser— no legacyrequire_adminremains. Snapshots updated to reflect the new pause-grant behavior.#770 — Cross-module dependency check
scripts/check_crate_cycles.py(walks workspacepath = "../…"deps and fails on any cycle) and wired it into.github/workflows/ci.yml.cargo treeshowstoken → admin/lifecycle/rate-limit/ttlwith no circular back-references.Verification
cargo buildandcargo test -p bc-forge-admin: 190 passed, 0 failed.cargo test -p bc-forge-lifecycle -p bc-forge-token: all pass.cargo fmt --checkandcargo clippy -D warnings: clean.