Skip to content

fix(database): restrict workspace service RPCs - #64

Merged
Programcode merged 1 commit into
mainfrom
t3code/workspace-acl-hardening
Sep 22, 2026
Merged

Programcode merged 1 commit into
mainfrom
t3code/workspace-acl-hardening

Conversation

@Programcode

@Programcode Programcode commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • revoke anon and authenticated execution from the two server-owned workspace generation RPCs
  • remove direct execution from private workspace text-projection trigger functions
  • add pgTAP coverage for the intended ACLs

Production finding

Post-merge catalog verification found that Supabase default privileges left authenticated able to execute start_workspace_thread_generation and complete_workspace_thread_generation. Both accept server-supplied user IDs and are intended for service_role only.

Verification

  • production catalog regression query failed before the fix
  • the forward migration passed a production transaction with an explicit ROLLBACK
  • supabase db push --dry-run lists only 20260922233256_harden_workspace_function_acl.sql
  • independent reviewer found no remaining actionable issues
  • local Docker database gate is waiting on the shared Supabase lock held by another worktree; CI database tests will run on this PR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Security

    • Strengthened workspace access controls by limiting thread-generation operations to authorized service access.
    • Prevented anonymous and authenticated access to private workspace version capture and restore operations.
    • Restricted private workspace text projection functions from direct execution by client-facing roles.
  • Tests

    • Added coverage to verify the updated execution permissions and prevent unauthorized workspace function access.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 23:40
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Sep 22, 2026 11:41pm UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 652843b9-0b8d-4796-bc57-ada323ea3d75

📥 Commits

Reviewing files that changed from the base of the PR and between 68c53f5 and ae01f7d.

📒 Files selected for processing (2)
  • supabase/migrations/20260922233256_harden_workspace_function_acl.sql
  • supabase/tests/workspace_practice_test.sql

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


📝 Walkthrough

Walkthrough

The migration restricts workspace thread-generation functions to service_role and removes execution privileges from private workspace projection functions. The SQL tests add assertions for these ACL rules and increase the expected assertion count.

Changes

Workspace ACL Hardening

Layer / File(s) Summary
Apply and validate workspace function ACLs
supabase/migrations/20260922233256_harden_workspace_function_acl.sql, supabase/tests/workspace_practice_test.sql
The migration limits thread-generation RPC execution to service_role and revokes execution for private capture and restore functions. The tests verify these permissions for anon, authenticated, and service_role, and increase the assertion count from 30 to 32.

Estimated code review effort: 2 (Simple) | ~10 minutes


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

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

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Programcode
Programcode merged commit 9e1e016 into main Sep 22, 2026
7 checks passed
@Programcode
Programcode deleted the t3code/workspace-acl-hardening branch September 23, 2026 00:02
@Programcode

Copy link
Copy Markdown
Owner Author

Production follow-through verified:

  • merged as 9e1e016dabd72b8456b73a6cad1f25463e196ba7
  • applied 20260922233256_harden_workspace_function_acl.sql to Supabase production
  • confirmed migration history has no drift
  • confirmed both generation RPCs are executable by service_role only
  • confirmed both private text-projection trigger functions have no direct execution grants
  • security advisors no longer report the two service-owned generation RPCs
  • Vercel production is READY on the merge commit and aliases debate.pi-stack.org
  • live browser smoke passed for the landing page, authenticated app shell, hidden workspace navigation, and workspace deep-link 404

No Edge Functions changed in this follow-up, so none were redeployed.

This branch was successfully deployed

1 active deployment
Preview — ae01f7d6 Deployed Sep 22, 2026 by vercel[bot]
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.

2 participants