feat(db): add supabase db advisors command for checking security and performance issues#4957
Draft
Rodriguespn wants to merge 1 commit intodevelopfrom
Draft
feat(db): add supabase db advisors command for checking security and performance issues#4957Rodriguespn wants to merge 1 commit intodevelopfrom
supabase db advisors command for checking security and performance issues#4957Rodriguespn wants to merge 1 commit intodevelopfrom
Conversation
…d performance issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request Test Coverage Report for Build 23119563210Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
supabase db advisorscommand that checks the database for security and performance issues — the CLI equivalent of theget_advisorsMCP tool.Why do we need this if we already have
get_advisorsin the MCP server?Same reasoning as
supabase db query(#4955): the MCP server works well for agents that go through the OAuth flow for remote projects, but for local development the human still has to reload the agent session to load MCP tools into context. This adds friction to a path that should be fully agentic (no human in the loop).With this command, an agent can check the security posture of the local database using just the CLI — no MCP configuration needed.
Example use case: security-aware migrations. The agent applies a migration that creates new tables, then runs
supabase db advisors --type securityto verify RLS is enabled and policies exist. If issues are found, the agent can fix them before committing the migration. Today this requires theget_advisorsMCP tool to be configured. With this command, the entire flow only needs the CLI.Implementation
supabase db advisors, default): Executes the same splinter SQL lints that the Studio dashboard runs. Uses pgx to connect directly to the local Postgres — consistent with every other localdbsubcommand (push,pull,diff,lint,test,reset,dump). Runs in a read-only transaction (always rolled back). No extensions required.supabase db advisors --linked): Calls the Management API endpoints (GET /v1/projects/{ref}/advisors/securityandGET /v1/projects/{ref}/advisors/performance), authenticated with the access token fromsupabase login.Differences from
db lintdb lintdb advisorsplpgsql_checkUsage
Test plan
go test ./internal/db/advisors/...— 15 unit tests covering: