feat(sandbox): L7 credential injection — query param rewriting and Basic auth encoding#631
Conversation
…sic auth encoding Add two credential injection capabilities to the L7 proxy's SecretResolver: 1. Query parameter rewriting: resolve placeholder tokens in URL query parameter values (e.g. ?api_key=openshell:resolve:env:KEY) with proper percent-encoding of the resolved secret. 2. Basic Authorization header encoding: decode base64 Basic auth tokens, resolve placeholder tokens in the decoded username:password string, and re-encode before forwarding upstream. Both features operate within the existing rewrite_http_header_block flow and require no changes to the network policy file spec or proto schema. Closes NVIDIA#630
|
Is there a UX change here? How would a user use these? |
|
No ux changed. I am testing this now. Essentially it's extending the reach of credentials injection into query parameters and basic authorization which won't work for credentials injection given query parameters are not headers and basic authentication is encoded base 64. It's required for github copilot integration seeing thst some calls use user:pat token Once I confirm it is working in a live env I will ping again |
|
Validated this by cherry-picking 95c7f91 onto v0.0.17 and hot-swapping the built sandbox binary into a running gateway on Ubuntu 24.04, kernel 6.17.0, Docker 29.0.4. Credential injection works as expected. Sandbox env shows @htekdev hope this helps with your testing. |
Yes. I am running trst and injection seems to work on the env level but I'm finding issues with the actual L7 traffic injection. Example for git they have issues but I'm see it's two separate issues one is ca cert and the other is it authenticated via basic oath flow so it won't perform replacement sent the underline content of the header is encoded. |
Dockerfile layers our patched sandbox binary on the official cluster image. deploy.sh automates: rsync source, build on 4090, package custom image, restart gateway. Temporary until PR NVIDIA#631 merges upstream. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Build openshell for linux-x86_64 and darwin-arm64. Publish as GitHub Release with checksums. Tag pattern: v0.0.18-pr631.N Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Adds two credential injection capabilities to the L7 proxy's
SecretResolver, closing the remaining gaps identified in #630 (supersedes #538 and #541).Query parameter rewriting
Resolves placeholder tokens in URL query parameter values before forwarding upstream. When the sandbox child process constructs a request like:
The proxy rewrites the request line to inject the real credential:
Basic Authorization header encoding
Supports credentials stored as raw
username:passwordthat need base64 encoding for HTTP Basic auth. When the child process constructs:The proxy decodes the base64 token, resolves placeholders in the decoded string, and re-encodes:
What's NOT changed
rewrite_http_header_blockflowTesting
11 new unit tests covering:
Closes #630