Skip to content

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

Draft
QuiiBz wants to merge 2 commits intomainfrom
sdk/add-l7-matchers
Draft

feat(sdk): add L7 requests matcher for network policies#171
QuiiBz wants to merge 2 commits intomainfrom
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 Apr 30, 2026 1:14pm
sandbox-cli Ready Ready Preview, Comment, Open in v0 Apr 30, 2026 1:14pm
sandbox-sdk Ready Ready Preview, Comment, Open in v0 Apr 30, 2026 1:14pm
sandbox-sdk-ai-example Ready Ready Preview, Comment, Open in v0 Apr 30, 2026 1:14pm
workflow-code-runner Ready Ready Preview, Comment, Open in v0 Apr 30, 2026 1:14pm

Comment thread packages/vercel-sandbox/src/network-policy.ts
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