Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
1 / 5
0

Safely inject credentials in HTTP headers with Vercel Sandbox - Vercel

Vercel News·Valerian Roche·4 days ago
#1Uh6Fabr
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More