Skip to content

Packs / admin-panels-and-internal-tools-public

enforce-rbac-and-audit-log

Enforce role-based permissions on every action and keep a tamper-evident (hash-chained) audit log

Install

logicpacks pack use admin-panels-and-internal-tools-public/enforce-rbac-and-audit-log
get_pack admin-panels-and-internal-tools-public/enforce-rbac-and-audit-log

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: stdlib-sqlite
  • Checks: 1 in outcome/checks.yaml
  • Code: admin.py
  • Tools: python3

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Enforce role-based permissions on every action and keep a tamper-evident (hash-chained) audit log

Goal

Users can only do what their role allows, and any edit to the audit history is detected.

Steps

  1. Define roles -> permissions (viewer: read; editor: read/write; admin: + export/admin).
  2. Check can(role, perm) server-side on every request; log denials too.
  3. admin.py audit-verify daily; alert on failure.

Edge cases

  • Role changes take effect on the next request.
  • Audit log growth: archive monthly, keep the last hash as the next genesis.

Don'ts

  • Don't check permissions only in the UI.
  • Don't allow UPDATE/DELETE on the audit table.