Repository navigation
fix(auth): the one-admin-gate guard refuses a new admin-check function; #20783 review lows (#16333) - #20795
fix(auth): the one-admin-gate guard refuses a new admin-check function; #20783 review lows (#16333)#20795mrveiss wants to merge 5 commits into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Code review on PR #20795 (head ec05b46): APPROVE No CRITICAL, HIGH or MEDIUM finding. Read-only review; tests were not run. Detector (read through the regex)
Recorded functions
Growth is visible. Any addition edits repeat_grouping
|
…reason as data; infix verbs matched (#16333)
|
Code review on PR #20795 (head caad9fb): APPROVE Delta review of caad9fb against the reviewed head ec05b46: one file,
I checked the three helpers the wider pattern surfaced. |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Follow-up to #16333 PRs A/B/C (#20753, #20776, #20783, landed in T66). It covers the AC "a guard fails any new local
def require_admin" and the three LOWs from the #20783 security review (#20787).Thinking Path
The one-admin-gate guard reads role literals and calls. A new
def require_admin(user): return is_admin_role(user["role"])would pass it, because it calls the one predicate but is still a second gate. So the guard now also reads function names:ws_security.authenticate_ws_adminandenforce_ws_admin, andtask_workspace_ws._authenticate_ws_admin) that the wider verb list found.What Changed
repo_tests/one_admin_gate_16333_test.py).require|ensure|assert|verify|has|check|authorize|authenticate|enforce) with any prefix, such asuser_has_adminorenforce_ws_admin;get_admin(_user|_role);validate_admin(_user|_role);is_*admin*;*_is_admin;*admin_(check|required|only|gate).Class.method. Lookalikes are pinned as non-hits:list_admins,admin_panel,is_administrator,get_admin_dashboard,_validate_admin_path,get_all_sysadmin_templates,validate_admin_username.match role: case "admin"(includingcase "admin" | "superadmin") anduser.role = "admin". The docstring lists the heuristic limits:role or "admin",re.match("admin", role), and literals from configuration.RepeatGrouper's docstring now states exactly when repeats are lost: when the key never recurs, or when a full tracker drops it. An expired key that recurs still reports them. Both behaviours are pinned by tests, and both callers' docstrings say so.role_denieddetails carryroute, the template the row groups, besideendpoint, the first path of the window.Verification
Python 3.14 parity venv:
The code-reviewer pass approved. The Trainmaster's review then approved, and its five LOWs are applied in the second push: qualified-name keys with reasons as data; one reason per entry instead of a shared comment; parametrized planted cases; infix verbs; and the corrected count. Its first-pass findings are also applied:
case "a" | "b"planted case is added.It spot-checked 13 recorded functions against the code and found every reason accurate, with none needing migration.
Risks
Model Used
Claude Opus 5.5 (
claude-opus-5-5)Issue Link
Closes #20787. Refs #16333.
Recorded on #16333: the SLM decision and the list of existing tests changed by A/B/C. The SLM
require_admin"legacy" wording waits for #20648, which holdsautobot-slm-backend/services/auth.py.Single-issue rationale: #16333's AC fix and its own review follow-up (#20787) touch the same guard; the other open children are blocked (#20751 on #20447, #20761 on #20587) or a separate rule (#20778).
🤖 Generated with Claude Code