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:
1 parent
369e741df1
commit
da01f2cbe1
28 files changed
+625
-116
No files matched your search
@@ -74,6 +74,18 @@ DO UPDATE SET count = access_denials.count + 1, updated_at = now();
|
||||
SELECT id, org_id, principal, action, resource_kind, resource_id, level, policies, minute_at, count, created_at, updated_at
|
||||
FROM access_denials WHERE org_id = $1 ORDER BY id DESC LIMIT $2;
|
||||
|
||||
-- name: PruneDenials :execrows
|
||||
-- The retention sweep's delete: every denial record created before the
|
||||
-- cutoff, oldest first in bounded batches so one sweep does not own the
|
||||
-- table for an unbounded time.
|
||||
DELETE FROM access_denials
|
||||
WHERE id IN (
|
||||
SELECT id FROM access_denials
|
||||
WHERE created_at < sqlc.arg(cutoff)::timestamptz
|
||||
ORDER BY created_at
|
||||
LIMIT sqlc.arg(batch)::bigint
|
||||
);
|
||||
|
||||
-- name: InsertAccessResetAudit :exec
|
||||
INSERT INTO sys_audit (at, table_name, record_key, field, record_version, actor, source, request_id, org_id)
|
||||
VALUES (now(), 'access_policies', $1, 'reset', 1, 'archie-state-store access reset', 'archie-state-store', '', $2);
|
||||
|
||||
Reference in new issue
Block a user