Skip to content

Feature: Supabase branch support#5334

Open
ngterzis wants to merge 7 commits intoInfisical:mainfrom
ngterzis:feature/supabase-branch-support
Open

Feature: Supabase branch support#5334
ngterzis wants to merge 7 commits intoInfisical:mainfrom
ngterzis:feature/supabase-branch-support

Conversation

@ngterzis
Copy link

@ngterzis ngterzis commented Jan 31, 2026

Context

Discussion/feature request: #5139
Supabase projects allow the creation of branches for different environments with a subscription. Currently, when creating a secrets sync in Infisical with a Supabase integration, there is no option to select the branch of the project, if more than one exists. By default, all secrets are synced to the main branch. These changes add the functionality of selecting a project branch.

Current version

image

New Version

image

 

image

 

image

 

image

Steps to verify the change

A Supabase project with a PRO subscription and two or more branches is required to verify that secrets are synced.

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Read the contributing guide

@maidul98
Copy link
Collaborator

maidul98 commented Jan 31, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 31, 2026

Greptile Overview

Greptile Summary

This PR adds support for Supabase project branches, enabling users with PRO subscriptions to sync secrets to specific branches instead of only the main branch.

Key Changes:

  • Added new API endpoint GET /:connectionId/projects/:projectId/branches to list available branches
  • Extended destination configuration schema to include optional projectBranchId and projectBranchName fields
  • Updated sync logic to use branch ID when specified, falling back to project ID for backward compatibility
  • Added branch selection dropdown in the UI with proper state management
  • Updated documentation to reflect the new branch selection feature

Implementation Details:

  • Backend properly validates the new endpoint with authentication and rate limiting
  • Frontend conditionally displays branch selector only when a project is selected and branches are available
  • The sync functions treat branch refs as separate project IDs (Supabase API design)
  • Backward compatible: existing syncs without branches continue to work

Minor Issues Found:

  • Missing newline at EOF in one TypeScript file
  • Consider using nullish coalescing (??) instead of logical OR (||) for better empty string handling
  • Verify that Supabase API enforces project access authorization based on the connection's access token

Confidence Score: 4.5/5

  • This PR is safe to merge with minimal risk - well-structured feature addition with backward compatibility
  • The implementation is clean and follows established patterns in the codebase. Authentication and authorization are properly handled through existing mechanisms. The feature is backward compatible. Minor style issues and verification recommendations don't block merging.
  • No files require special attention - all changes follow consistent patterns and include proper error handling

Important Files Changed

Filename Overview
backend/src/server/routes/v1/app-connection-routers/supabase-connection-router.ts Added new endpoint for listing project branches with proper auth and validation
backend/src/services/app-connection/supabase/supabase-connection-public-client.ts Added getProjectBranches API call, projectId param could be validated
backend/src/services/secret-sync/supabase/supabase-sync-fns.ts Updated to use projectBranchId as fallback to projectId for sync operations
frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SupabaseSyncFields.tsx Added branch selection dropdown with proper state management
frontend/src/hooks/api/appConnections/supabase/queries.tsx Added useSupabaseConnectionListProjectBranches hook for fetching branches

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

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