Skip to content

docs(cli): campus.audit auth structure — superadmin class, web key sign-in - #66

Merged
ngjunsiang merged 1 commit into
mainfrom
feat/65-audit-auth-docs
Oct 20, 2026
Merged

ngjunsiang merged 1 commit into
mainfrom
feat/65-audit-auth-docs

Conversation

@ngjunsiang

Copy link
Copy Markdown
Contributor

Closes #65

Summary

Brings the CLI's campus.audit documentation and module docstrings in
line with the service's auth structure as of campus#916 (development-
only API-key sign-in for the web UI) and campus#929 (AUDIT_ADMINS
redefined as the campus.audit superadmin class with two named
capabilities). Several spots described the whole audit service as
uniformly key-only — true of /audit/v1 only — and none mentioned the
capability model.

Changes

  • README section "campus.audit: API-key auth (feat(cli): campus audit command group — API-key auth, key management, trace queries #54)":
    • the opening paragraph now distinguishes the two auth lanes: the
      versioned API (/audit/v1, key-only Bearer — everything the CLI
      talks to) vs. the web UI's separate gate (campus-account
      superadmins via AUDIT_ADMINS, plus dev-only key sign-in)
    • new paragraph on the scope-to-capability mapping: traces:read ↔
      trace surfaces, apikeys:write ↔ key management, scope-by-scope
      and not interchangeable; apikeys:read alone admits no browser
      session; superadmins hold both by being on the list
    • operator bullet: the seed from AUDIT_OPERATOR_API_KEY carries
      apikeys:read/apikeys:write plus every traces:* scope
    • student bullet: the same traces:read key also signs into the
      dev-environment browser trace viewer; revocation/re-scoping ends
      the browser session on its next request; the path does not exist
      outside development
  • campus_cli/audit/__init__.py, client.py, login.py
    docstrings: "the audit API (/audit/v1)" where key-only is claimed,
    with a pointer to the campus#929/#916 browser gate
  • campus_cli/audit/keys.py docstring: the operator seed is the
    apikeys:* bootstrap class, but minting does not validate scopes, and
    apikeys:write is also the web key-management capability — hand one
    out deliberately (verified against campus weekly apikeys.new())
  • campus_cli/utils/output.py preamble comment: same /audit/v1
    scoping

Facts cross-checked against campus weekly at a8465ed7 (includes both
PRs): /audit/v1 unaffected by the web gate; AUDIT_ADMINS unset or
empty is fail-closed; the sign-in session stores key id + owner label

  • expiry, never the plaintext; operator seed scopes are
    apikeys:read/write + traces:read/write/search.

Testing

Docs and comments only — no behavior change. Suite: 293 passed,
ruff check clean.

Related

…gn-in (#65)

campus#916 (dev-only API-key sign-in for the audit web UI) and
campus#929 (AUDIT_ADMINS redefined as the campus.audit superadmin
class with can_view_traces/can_manage_keys) changed the service's
auth structure; the CLI's docs and docstrings predated both and
described the whole service as uniformly key-only.

- README audit section: scope the key-only claim to /audit/v1,
  describe the web UI's separate gate (OAuth superadmins + dev-only
  key sign-in), add the scope-to-capability mapping, note the
  operator seed's actual scopes, and that a minted traces:read key
  also opens the dev browser trace viewer
- audit/__init__.py, client.py, login.py docstrings: say "the audit
  API (/audit/v1)" where key-only is claimed; point the browser gate
  at campus#929/#916
- audit/keys.py docstring: the operator seed is the apikeys:*
  bootstrap class, not the only possible holder — minting does not
  validate scopes, and apikeys:write doubles as the web key-
  management capability
- utils/output.py preamble comment: same /audit/v1 scoping

No behavior change; suite 293 passed, ruff clean.
@ngjunsiang
ngjunsiang merged commit 8b06fc6 into main Oct 20, 2026
4 checks passed
@ngjunsiang
ngjunsiang deleted the feat/65-audit-auth-docs branch October 20, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: reflect the new campus.audit auth structure (superadmin class, web key sign-in)

1 participant