Skip to content

feat(rbac): seed the audit:read permission - #76

Open
Diubii wants to merge 3 commits into
mainfrom
Diubii/audit-read-permission
Open

Diubii wants to merge 3 commits into
mainfrom
Diubii/audit-read-permission

Conversation

@Diubii

@Diubii Diubii commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds migration 0023_audit_read_permission, which seeds audit:read ("Read the audit log") the same way 0016 seeds the rest of the migration catalog: an ordinary permission (managed = false), no role granted, ON CONFLICT (key) DO NOTHING.
  • The snapshot is a copy of 0022's: the schema is unchanged.

Why

The central audit log (PoliNetworkOrg/backend#90) and its dashboard page (PoliNetworkOrg/admin#123) check audit:read, but no environment defines it. Master Admin's wildcard only covers permissions that exist in the catalog (resolveAccess in src/auth/rbac.ts), so today nobody can open the page, not even Master Admin, and it can't be given to any role.

Test plan

  • drizzle-kit migrate on a local DB: the permission is created
  • drizzle-kit check
  • vp check, vp test

🤖 Generated with Claude Code

The backend's central audit log and the admin dashboard page that shows it check
`audit:read`, which no environment defined, so only Master Admin could open it.
Seed it with the rest of the migration catalog so it can be given to a role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This change adds an unmanaged audit:read permission for audit-log access and records its migration in the journal. The insert leaves an existing permission with the same key unchanged.

Changes

Audit Read Permission

Layer / File(s) Summary
Add and register audit read permission
drizzle/0025_audit_read_permission.sql, drizzle/meta/_journal.json
The migration inserts the unmanaged audit:read permission without changing an existing permission with the same key. The journal adds migration entry 25.

Change: Feature

Merge Risk: Minimal · up to be897

This seeds the audit:read permission so it can be assigned to roles and used by the audit log. The migration is small and safe to re-run, and it does not grant the permission to any role. Merge risk is minimal.

Pre-merge checks: Passed 3

Check name Status Explanation
Title check Passed The title "feat(rbac): seed the audit:read permission" matches the main change. The migration seeds the audit:read permission, which the PR objectives describe as needed by the audit log and admin das…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(rbac): seed the audit:read permission" matches the main change. The migration seeds the audit:read permission, which the PR objectives describe as needed by the audit log and admin dashboard. The title is concise and specific. The raw summary describes the migration as adding the permission with a description and an insert that does nothing on conflict. The title does not name the migration file, but it does not need to.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9fe232e and be89761.

Files ignored due to path filters: 1

  • drizzle/meta/0025_snapshot.json is excluded by !drizzle/meta/*_snapshot.json
Files selected for processing: 2

  • drizzle/0025_audit_read_permission.sql
  • drizzle/meta/_journal.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Diubii Diubii self-assigned this Oct 27, 2026
Diubii and others added 2 commits November 2, 2026 16:43
Main added 0023_role_people_binding, so the audit:read migration moves to 0024.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mission

# Conflicts:
#	drizzle/meta/0024_snapshot.json
#	drizzle/meta/_journal.json
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