惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
A
About on SuperTechFans
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
S
SegmentFault 最新的问题
V
Visual Studio Blog
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
美团技术团队

Vercel News

Vercel Open Source Program: Winter 2026 cohort How Notion Workers run untrusted code at scale with Vercel Sandbox How we run Vercel's CDN in front of Discourse From idea to secure checkout in minutes with Stripe Building Slack agents can be easy Scaling redirects to infinity on Vercel Advancing Python typing Gamma builds design-first agents with Vercel How Avalara turns pipe dreams into patent-pending with v0 Keeping community human while scaling with agents How OpenEvidence built a healthcare AI that physicians actually trust Security boundaries in agentic architectures Skills Night: 69,000+ ways agents are getting smarter Video Generation with AI Gateway We Ralph Wiggumed WebStreams to make them 10x faster How Stably ships AI testing agents in hours, not weeks How we built AEO tracking for coding agents Anyone can build agents, but it takes a platform to run them Introducing Geist Pixel The Vercel AI Accelerator is back with $6m in credits Making agent-friendly pages with content negotiation The Vercel OSS Bug Bounty program is now available Introducing the new v0 Run untrusted code with Vercel Sandbox, now generally available How Stripe built a game-changing app in a single flight with v0 How Sensay went from zero to product in six weeks AGENTS.md outperforms skills in our agent evals Agent skills explained: An FAQ Testing if "bash is all you need" AWS databases are now live on the Vercel Marketplace and v0
Safely inject credentials in HTTP headers with Vercel San...
Valerian RocheSoftware EngineerRob HerleySoftware Engineer · 2026-02-23 · via Vercel News

Vercel Sandbox can now automatically inject HTTP headers into outbound requests from sandboxed code. This keeps API keys and tokens safely outside the sandbox VM boundary, so apps running inside the sandbox can call authenticated services without ever accessing the credentials.

Header injection is configured as part of the network policy using transform. When the sandbox makes an HTTPS request to a matching domain, the firewall adds or replaces the specified headers before forwarding the request.

const sandbox = await Sandbox.create({

timeout: 300_000,

networkPolicy: {

allow: {

"ai-gateway.vercel.sh": [{

transform: [{

headers: {

authorization: `Bearer ${process.env.AI_GATEWAY_API_KEY}`

}

}],

}],

},

},

});

// Code inside the sandbox calls AI Gateway without knowing the API key

const result = await sandbox.runCommand('curl',

['-s', 'https://ai-gateway.vercel.sh/v1/models']

);

This is designed for AI agent workflows where prompt injection is a real threat. Even if an agent is compromised, there's nothing to exfiltrate, as the credentials only exist in a layer outside the VM.

Injection rules work with all egress network policy configurations, including open internet access. To allow general traffic while injecting credentials for specific services:

const sandbox = await Sandbox.create({

networkPolicy: {

allow: {

"ai-gateway.vercel.sh": [{

transform: [{

headers: {

Authorization: `Bearer ${process.env.AI_GATEWAY_API_KEY}`

}

}],

}],

"*.github.com": [{

transform: [{

headers: {

Authorization: `Bearer ${process.env.GITHUB_TOKEN}`

}

}],

}],

// Allow traffic to all other domains.

"*": []

}

}

});

Link to headingLive updates

Like all network policy settings, injection rules can be updated on a running sandbox without restarting it. This enables multi-phase workflows, inject credentials during setup, then remove them before running untrusted code:

// Phase 1: Clone repos with credentials

await sandbox.updateNetworkPolicy({

allow: {

"api.github.com": [{

transform: [{

headers: {

Authorization: `Bearer ${process.env.GITHUB_TOKEN}`

}

}],

}],

}

});

// ... clone repos, download data ...

// Phase 2: Lock down before running untrusted code

await sandbox.updateNetworkPolicy('deny-all');

Link to headingKey highlights

  • Header overwrite: Injection applies to HTTP headers on outbound requests.

  • Full replacement: Injected headers overwrite any existing headers with the same name set by sandbox code, preventing the sandbox from substituting its own credentials.

  • Domain matching: Supports exact domains and wildcards (e.g., *.github.com). Injection only triggers when the outbound request matches.

  • Works with all policies: Combine injection rules with allow-all, or domain-specific allow lists.

Available to all Pro and Enterprise customers. Learn more in the documentation.