fix(security): missing maximum operation limits: unbounded file array and content size in deployedgefunction [MEDIUM]#254
Open
failsafesecurity wants to merge 1 commit intosupabase-community:mainfrom
Conversation
… and content size in deployedgefunction [MEDIUM]
8d49ea3 to
2d40915
Compare
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.
Security Finding: Missing Maximum Operation Limits: Unbounded file array and content size in deployEdgeFunction
Severity: MEDIUM
Reported by: FailSafe Security Researcher
Component:
packages/mcp-server-supabase/src/platform/types.ts:75Description
The vulnerability identified in the source file involves missing maximum operation limits on file arrays and content sizes. Specifically, the code at the specified source implements the
deployEdgeFunctionOptionsSchemabut fails to adequately enforce.max()constraints on thefilesarray and thecontentstring. This omission allows an attacker or a malfunctioning LLM to provide a massive number of files or extremely large file contents. In the context of deploying an edge function, this means that the MCP server reads this unbounded array and constructs aFormDataobject withBlobinstances for each file in memory. The root cause is the absence of strict schema validation boundaries. When user-controlled input is processed by this component without proper validation or boundary checks, the system enters an insecure state leading to resource exhaustion. This type of flaw is particularly dangerous because it trivially enables OOM crashes. Furthermore, the lack of defense-in-depth mechanisms exacerbates the risk, potentially leading to severe operational disruption.Fix
Update the
deployEdgeFunctionOptionsSchemainpackages/mcp-server-supabase/src/platform/types.tsto enforce strict.max()limits on both thefilesarray and thecontentstring using Zod.typescript export const deployEdgeFunctionOptionsSchema = z.object({ // ... other fields files: z.array( z.object({ name: z.string().max(255), content: z.string().max(5 * 1024 * 1024) // 5MB limit per file }) ).max(50) // Max 50 files });Ensure that the limits align with the Supabase Edge Functions deployment constraints.