Skip to content

feat(iam): audit access denials reported by client-side page guards - #58

Merged
zaxovaiko merged 2 commits into
devfrom
feat/iam-report-access-denied
Aug 5, 2026
Merged

feat(iam): audit access denials reported by client-side page guards#58
zaxovaiko merged 2 commits into
devfrom
feat/iam-report-access-denied

Conversation

@zaxovaiko

@zaxovaiko zaxovaiko commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds iam.reportAccessDenied so a client-side PermissionGate redirect (which never reaches the server on its own) can be recorded server-side, closing the gap called out in docs/standards/audit.md.
  • Service re-verifies the caller's actual level before recording — a caller who genuinely holds the permission cannot produce a false denial entry.
  • Throttled to one audit row per 60s per (caller, resource) via the existing RATE_LIMITER adapter; throttled repeats are silently skipped, never surfaced as an error.
  • Reuses the existing identity.user.unauthorized_access event, so the audit module needs no changes.

Why

BF-412 (downstream MR !142): a restricted admin blocked from a page produced no audit trail, since PermissionGate's redirect is client-side only. This is the core-side half — the platform route the consumer calls to report the denial.

Test plan

  • pnpm --filter @openora/core check:types clean
  • pnpm regendocs/catalog.json picks up the new route
  • Iam integration suite: 44/44 passing (incl. 3 new tests: genuine denial records + emits, genuine holder does not, throttled repeat is skipped)
  • Full pnpm verify gate (typecheck, lint, format, boundaries, shape, deprecations, unit, integration, drift) passed pre-commit

Adds iam.reportAccessDenied so a client-side PermissionGate redirect
can be recorded server-side. The service re-verifies the caller's
actual level before recording, so a genuine permission holder cannot
produce a false denial entry, and throttles repeats to one audit row
per 60s per caller/resource.
@zaxovaiko zaxovaiko self-assigned this Aug 5, 2026
@zaxovaiko
zaxovaiko merged commit 0c3385e into dev Aug 5, 2026
2 checks passed
@zaxovaiko
zaxovaiko deleted the feat/iam-report-access-denied branch August 5, 2026 22:59
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.

1 participant