Feature/supabase integration - #1
Merged
Merged
Conversation
Updated connection string to require Supabase secret key instead of publishable key.
SupabaseQueryService now supports executing Postgres function (RPC) calls via Supabase REST by parsing input and sending POST requests to the RPC endpoint.
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
Adds Supabase as a supported database source, via two paths:
postgresql://user:pass@host:port/dbURI (e.g. Supabase's own connection string) in addition to the classicHost=...;Port=...;keyword format. Full schema browsing via normalpg_catalogintrospection, no API keys involved.What changed
New provider
DataProviders/Supabase/—SupabaseDatabaseProvider,SupabaseDatabaseConnection,SupabaseQueryService,SupabaseConnectionInfoDatabaseProviderType.Supabaseadded to the enum; registered inApp.xaml.csDI alongside the other providers — no other wiring needed, the provider dropdown builds itself from DI registrationsPostgreSQL provider
PostgreSqlConnectionStringNormalizer— detects apostgres:///postgresql://prefix and converts it to anNpgsqlConnectionStringBuilderstring before use, so a pasted Supabase (or any) Postgres URI just worksConnectionStringPlaceholderupdated to mention the URI form is acceptedUI (
MainWindow.xaml/MainViewModel.cs)ConnectionString(Url=...;ApiKey=...;), so saved connections and the connect flow are unaffectedsb_publishable_...key is pasted into the API Key box — Supabase blocks that key tier from schema introspection at the platform level, so it needs to fail loudly and immediately rather than only on ConnectQuery editor for Supabase
ExecuteQueryAsyncon the Supabase provider instead calls a Postgres function (RPC) by name:my_functionormy_function {"arg": 1}messagefield rather than a generic HTTP failureDocs
README.md: new "Connecting to Supabase" section covering both paths, with an explicit warning about the secret key (see below); Supabase added to feature list, connection string table, project structure tree, and Known limitationsWhy two paths, and why the REST one needs a secret key
Supabase's REST API only exposes schema introspection (
/rest/v1/OpenAPI spec) to the secret key, not the publishable/anon key — a publishable key connects fine but can't list tables/columns, by design on Supabase's end, not a bug here. The app now makes this explicit instead of silently failing: the connect error, the textbox warning, and the README all say secret-key-required.The PostgreSQL path (Option 1) is the one to recommend when a direct DB connection is available, since it avoids the API-key/permission-tier question entirely.
The Supabase secret key is not equivalent to a scoped database login. It bypasses Row Level Security entirely and has full administrative access to every table in the project. A leaked SQL Server/Postgres password exposes one database with whatever permissions that login has; a leaked Supabase secret key exposes the entire project.
Mitigations already in place:
[!WARNING]callout, separate from the general security notesConnectionString)Worth a second opinion from reviewers: is DPAPI-at-rest + inline warnings sufficient here, or do we want something stronger (e.g. a confirmation dialog on first paste of a
sb_secret_...-prefixed value) before this ships?Testing done
postgres://URI pasted into the PostgreSQL provider connects and browses schema identically to the keyword formatKnown follow-ups (not blocking, not in this PR)
publicschema and can't distinguish views from tables (both come from the same OpenAPI spec)Supabase/Supabase.PostgrestNuGet package for users who want compile-time models for specific tables, but that doesn't fit the app's dynamic-schema-discovery model as a replacement for the current approach