You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security(slm): a refused non-admin session leaves no audit record #20664
The SLM's admin-only rule (#20628, PR #20634) refuses a non-admin session in get_current_user (autobot-slm-backend/services/auth.py) with a 403 before the permission gate runs. That refusal only writes a log warning, so it leaves no audit record, while the gate's own denials do. Refused SSO logins are already audited as failures.
The cross-service parity test now scopes its audit rule to gate denials, so nothing checks this path.
Decision needed
Should a refused non-admin session write an audit record? Recording each one gives a paper trail, but it adds a write on every probe with a stale or non-admin token, so it may need rate limiting or aggregation.
Acceptance criteria
The decision is recorded on this issue.
If audited: a refused non-admin session writes a denial record, with a test, and repeated probes can't flood the store.
If not audited: the reason is written beside the refusal in get_current_user.
Maintainer decision (2026-11-02): audit refused non-admin SLM sessions, and rate-limit or group the repeats so probes can't flood the audit store. The PR waits until it's scheduled.
Landed: PR #20700 in merge train #20715 (merge 6f8c8d9f82), commits 240a288 and 6c98ac4. Checked on main at 6f8c8d9. Gate 2: the forward-reference check from pipeline-scripts/check-issue-close-refs.sh, run against origin/main → clear (5 historical mentions, none forward-tracking).
Acceptance criteria (verbatim):
"The decision is recorded on this issue." — ✅ maintainer decision comment of 2026-11-02: audit refused non-admin sessions, grouping repeats so probes cannot flood the store.
"If audited: a refused non-admin session writes a denial record, with a test, and repeated probes can't flood the store." — ✅ autobot-slm-backend/services/auth.py:292-294 calls note_refused_session(payload.get("sub")) before refusing; services/refused_session_audit.py keeps one record per person per WINDOW_S (AUTOBOT_SLM_REFUSED_SESSION_AUDIT_WINDOW_S, default 300, clamped 1–86400) and caps tracked subjects at _MAX_TRACKED = 10_000. Tests in tests/services/test_refused_session_audit_20664.py: test_the_first_refusal_writes_a_denial_naming_the_person, test_repeats_in_the_window_write_nothing_and_the_next_record_counts_them, test_each_person_gets_their_own_record, test_the_tracked_set_cant_grow_past_its_cap, test_get_current_user_records_before_refusing.
"If not audited: the reason is written beside the refusal in get_current_user." — not applicable: the decision was to audit, so this branch does not apply. Left unticked deliberately.
Follow-up filed: #20729 (a failed refused-session audit write still closes the person's audit window, so the next refusal in that window is not recorded).
Activity
mrveiss commentedon Nov 2, 2026
Maintainer decision (2026-11-02): audit refused non-admin SLM sessions, and rate-limit or group the repeats so probes can't flood the audit store. The PR waits until it's scheduled.
fix(train): the refused-session audit states what the cap drops (#20664)
mrveiss commentedon Nov 3, 2026
✅ Closed with proof of implementation
Landed: PR #20700 in merge train #20715 (merge
6f8c8d9f82), commits 240a288 and 6c98ac4. Checked onmainat 6f8c8d9.Gate 2: the forward-reference check from
pipeline-scripts/check-issue-close-refs.sh, run againstorigin/main→ clear (5 historical mentions, none forward-tracking).Acceptance criteria (verbatim):
autobot-slm-backend/services/auth.py:292-294callsnote_refused_session(payload.get("sub"))before refusing;services/refused_session_audit.pykeeps one record per person perWINDOW_S(AUTOBOT_SLM_REFUSED_SESSION_AUDIT_WINDOW_S, default 300, clamped 1–86400) and caps tracked subjects at_MAX_TRACKED = 10_000. Tests intests/services/test_refused_session_audit_20664.py:test_the_first_refusal_writes_a_denial_naming_the_person,test_repeats_in_the_window_write_nothing_and_the_next_record_counts_them,test_each_person_gets_their_own_record,test_the_tracked_set_cant_grow_past_its_cap,test_get_current_user_records_before_refusing.get_current_user." — not applicable: the decision was to audit, so this branch does not apply. Left unticked deliberately.Follow-up filed: #20729 (a failed refused-session audit write still closes the person's audit window, so the next refusal in that window is not recorded).
fix(slm): a refused non-admin session is audited, with repeats grouped (