Skip to content

fix(mcp-server-supabase): keep verify_jwt on redeploy when the call leaves it out - #682

Open
mateusvoc13 wants to merge 1 commit into
supabase:mainfrom
mateusvoc13:fix/keep-verify-jwt-on-redeploy
Open

mateusvoc13 wants to merge 1 commit into
supabase:mainfrom
mateusvoc13:fix/keep-verify-jwt-on-redeploy

Conversation

@mateusvoc13

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Fixes #681

deploy_edge_function defaults verify_jwt to true in the tool schema, so a redeploy that leaves the flag out turns JWT verification back on for a function that had it off. A webhook that checks its own signature then starts getting 401s. The tool description already asks the agent to keep the old setting, but the agent can't see it without a get_edge_function call, and the schema default overrides it when it doesn't make one.

What is the new behavior?

  • verify_jwt is optional in the tool schema, with no default. The description now says to leave it out to keep the current setting.
  • When the call leaves it out, deployEdgeFunction reads the function's current setting and keeps it.
  • A 404 means a new function, which gets true. The secure default for new functions doesn't change.
  • Any other lookup error stops the deploy. It doesn't guess true or false.
Redeploy of a function with verify_jwt: false Before After
verify_jwt left out true false
verify_jwt: true true true
verify_jwt left out, lookup returns 500 true deploy fails, setting unchanged
New function, verify_jwt left out true true

This changes the tool definition (verify_jwt loses its default). Flagging it given #467 and the OpenAI plugin scanner.

How to Review

  1. Deploy path

    • packages/mcp-server-supabase/src/platform/api-platform.ts
    • The new block after the existing-function lookup in deployEdgeFunction. It only runs when verify_jwt is undefined. It uses its own metadata call instead of the existing try/catch, so a failed lookup can't turn into a silent true.
  2. Tool schema

    • packages/mcp-server-supabase/src/tools/edge-function-tools.ts
    • .default(true) becomes .optional(), and the description is updated.
  3. Tests

    • packages/mcp-server-supabase/src/server.functions.test.ts
    • Redeploying without verify_jwt keeps it false. A 500 on the lookup stops the deploy and leaves the function's setting unchanged.

Review questions

  • Is keeping the current setting the behavior you want, or do you prefer the CLI's "default to true unless config says otherwise"?
  • Is the extra metadata call acceptable on redeploys that leave out verify_jwt?
  • Does the tool-definition change need to wait for an OpenAI plugin review window?

Verification

  • The new redeploy test fails on main (expected true to be false) and passes with the fix.
  • vitest --project unit: 40 files, 1192 tests pass.
  • tsc --noEmit and biome check clean on the changed files.

@mateusvoc13
mateusvoc13 requested a review from a team as a code owner December 5, 2026 18:37
@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Redeploying an edge function without specifying JWT verification now preserves its current setting.
    • New edge functions default to JWT verification being enabled when the setting is omitted.
    • Deployments now stop if the current settings cannot be retrieved due to an unexpected error.

When verify_jwt is omitted, the deployment input leaves it undefined. Deployment reads the function settings and uses the current value; a 404 or a missing value defaults to true. Other unsuccessful responses fail the deployment. Tests cover retaining false on redeployment and rejecting an HTTP 500 settings response.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant deployEdgeFunction
  participant FunctionsAPI
  Caller->>deployEdgeFunction: Deploy without verify_jwt
  deployEdgeFunction->>FunctionsAPI: Read function settings
  alt Settings found
    FunctionsAPI-->>deployEdgeFunction: Current verify_jwt value
  else Settings return 404
    FunctionsAPI-->>deployEdgeFunction: 404
    deployEdgeFunction->>deployEdgeFunction: Set verify_jwt to true
  end
  deployEdgeFunction->>FunctionsAPI: Deploy with resolved verify_jwt
Loading

Assessment against linked issues

Objective Addressed Explanation
Preserve verify_jwt: false when redeploying without the setting [#681] ✅

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to c6162

Redeploying an edge function without verify_jwt now keeps its current setting, and new functions still default to true. Lookup failures other than 404 stop the deployment. No concrete merge-blocking risk was identified.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b87106a-04d0-4ee3-8a4a-c51c4de54062
Commits

Reviewing files that changed from the base of the PR and between f9ef1dc and c61626d.

Files selected for processing: 2

  • packages/mcp-server-supabase/src/platform/api-platform.ts
  • packages/mcp-server-supabase/src/server.functions.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

…eaves it out

deploy_edge_function defaulted verify_jwt to true in the tool schema, so a
redeploy without the flag turned JWT verification back on for functions
that had it off, such as webhooks that check their own signature.

verify_jwt is now optional. When it's left out, the deploy reads the
function's current setting and keeps it. A 404 means a new function, which
defaults to true. Any other lookup error stops the deploy.

Fixes supabase#681
@mateusvoc13
mateusvoc13 force-pushed the fix/keep-verify-jwt-on-redeploy branch from f9ef1dc to c61626d Compare December 5, 2026 18:45

This branch has not been deployed

No deployments
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.

deploy_edge_function turns JWT verification back on when a redeploy leaves out verify_jwt

1 participant