Skip to content

feat(sdk): add L7 requests matcher for network policies#171

Closed
QuiiBz wants to merge 3 commits into
mainfrom
sdk/add-l7-matchers
Closed

feat(sdk): add L7 requests matcher for network policies#171
QuiiBz wants to merge 3 commits into
mainfrom
sdk/add-l7-matchers

Conversation

@QuiiBz
Copy link
Copy Markdown
Member

@QuiiBz QuiiBz commented Apr 30, 2026

This PR adds support for L7 requests matcher in network policies: for each NetworkPolicyRule, you can apply a matcher on:

  • the request method
  • the request path
  • the request query strings
  • the request headers

Each matcher can target to either exactly match, start with, or regex match, a provided value. For example, to inject an authorization header on requests to Vercel's AI gateway but only on specific requests:

allow: {
  "ai-gateway.vercel.sh": [
    {
      match: {
        method: ["POST"],
        path: { startsWith: "/v1/" },
        headers: [
          { key: { exact: "x-api-key" }, value: { exact: "placeholder" } }
        ]
      },
      transform: [{
        headers: { authorization: "Bearer ..." }
      }]
    }
  ],
  "*": []
}

@QuiiBz QuiiBz requested a review from tutman96 April 30, 2026 12:49
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sandbox Ready Ready Preview, Comment, Open in v0 May 6, 2026 0:57am
sandbox-cli Ready Ready Preview, Comment, Open in v0 May 6, 2026 0:57am
sandbox-sdk Ready Ready Preview, Comment, Open in v0 May 6, 2026 0:57am
sandbox-sdk-ai-example Ready Ready Preview, Comment, Open in v0 May 6, 2026 0:57am
workflow-code-runner Ready Ready Preview, Comment, Open in v0 May 6, 2026 0:57am

Comment thread packages/vercel-sandbox/src/network-policy.ts
@QuiiBz
Copy link
Copy Markdown
Member Author

QuiiBz commented May 6, 2026

#173

@QuiiBz QuiiBz closed this May 6, 2026
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