Skip to content

[Plan 002] Restrict audit-log creation to trusted database operations - #11

Merged
prof-ramos merged 1 commit into
mainfrom
agent/002-audit-integrity
Aug 3, 2026
Merged

[Plan 002] Restrict audit-log creation to trusted database operations#11
prof-ramos merged 1 commit into
mainfrom
agent/002-audit-integrity

Conversation

@prof-ramos

Copy link
Copy Markdown
Owner

Implements Plan 002 and closes #6 when merged.

What changed

  • Adds a forward-only audit_integrity migration created by the Supabase CLI.
  • Keeps the server-side audit helper intact but revokes its generic EXECUTE privilege from public and authenticated.
  • Reasserts that authenticated clients cannot insert directly into audit_logs.
  • Extends pgTAP with owner denial, gate denial, direct-insert denial, and unchanged-row-count assertions.
  • Documents the trusted transaction boundary for future business operations.

Why

A generic client-callable audit RPC allowed authenticated members to choose arbitrary audit actions and metadata. Audit entries must be emitted by operation-specific trusted database code.

Checks

  • pnpm check
  • pnpm supabase:test: 24 assertions passed on local Supabase
  • git diff --check

Stacking

This draft is based on PR #10 (agent/001-verification-baseline) so its diff contains only Plan 002 changes relative to that PR. Do not merge it before the base PR.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@prof-ramos, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f2b9486b-452e-49ff-86d1-7f180dca57e2

📥 Commits

Reviewing files that changed from the base of the PR and between 9207929 and a146836.

📒 Files selected for processing (5)
  • plans/002-restrict-audit-log-writes.md
  • plans/README.md
  • supabase/README.md
  • supabase/migrations/20260803070351_audit_integrity.sql
  • supabase/tests/database/rls_and_check_in.sql

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

Comment @coderabbitai help to get the list of available commands.

@prof-ramos
prof-ramos changed the base branch from agent/001-verification-baseline to main August 3, 2026 08:45
@prof-ramos
prof-ramos marked this pull request as ready for review August 3, 2026 08:45
@prof-ramos
prof-ramos merged commit 178b785 into main Aug 3, 2026
3 checks passed
@prof-ramos
prof-ramos deleted the agent/002-audit-integrity branch August 3, 2026 09:18
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.

[Plan 002] Restrict audit-log creation to trusted database operations

1 participant