feat(access): denial retention knob, State Store sweep and dashboard denials page (#1842)

Add [access].denial_retention (default 90 days, matching the audit-retention
seed) wired through config defaults and validation; the State Store sweeps
denial records older than the configured age hourly via the new
access.DenialPruner / PruneDenials store query. The dashboard gains
GET /api/access/denials (read_audit-gated, so org admins/owners see their
org's records; the store scopes by the credential's org) and an
/org/denials page backed by a Pinia store.
This commit is contained in:
sam committed 2026-10-31 14:23:31 +11:00
1 parent 369e741df1
commit da01f2cbe1
28 files changed
+625 -116

No files matched your search

+15 -4
View File
@@ -305,8 +305,8 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res
switch {
case matchSegment(path, "/api/tasks/", "/logs"), matchSegment(path, "/api/tasks/", "/sandbox"):
return access.ActionReadLogs, access.KindTask, segmentValue(path, 2), true
case matchPrefix(path, "/api/access/policies"):
return policyAction(action), access.KindPolicy, "", true
case matchPrefix(path, "/api/access"):
return accessRoute(action, path)
case matchPrefix(path, "/api/identities"):
return actionManage(action), access.KindIdentity, segmentValue(path, 2), true
case matchPrefix(path, "/api/orgs"):
@@ -406,8 +406,17 @@ func kindOf(path string) access.ResourceKind {
return access.KindDashboard
}
// actionManage lifts a create or update on a managed surface to the manage
// action the role vocabulary carries.
// accessRoute maps the access routes: policy management on the policies
// routes, and on the denials route the same read_audit grant the audit feed
// carries, which the shipped role policies give an org's admins and owners
// only -- denial records are the access trail's operator surface.
func accessRoute(action access.Action, path string) (access.Action, access.ResourceKind, string, bool) {
if matchPrefix(path, "/api/access/policies") {
return policyAction(action), access.KindPolicy, "", true
}
return access.ActionReadAudit, access.KindAudit, "", true
}
// policyAction lifts every write on the policy routes to manage_policies.
func policyAction(action access.Action) access.Action {
if action == access.ActionRead {
@@ -416,6 +425,8 @@ func policyAction(action access.Action) access.Action {
return access.ActionManagePolicies
}
// actionManage lifts a create or update on a managed surface to the manage
// action the role vocabulary carries.
func actionManage(action access.Action) access.Action {
switch action {
case access.ActionCreate, access.ActionUpdate: