Skip to content

feat(sandbox): L7 credential injection — query parameter rewriting and Basic auth encoding #630

@htekdev

Description

@htekdev

Summary

Two specific gaps remain in the L7 credential injection system after the existing header injection pattern (used by inference.local) was established. This issue tracks adding support for:

  1. Query parameter rewriting — inject credentials as URL query parameters (e.g., ?api_key=VALUE)
  2. Basic Authorization header encoding — support raw username:password credentials that need base64 encoding before injection as Authorization: Basic <base64>, including decode/rewrite/re-encode flows

Prior work

The L7 proxy already handles simple header injection (e.g., x-api-key: VALUE or Authorization: Bearer VALUE). These two cases require additional logic.

Use Case 1: Query Parameter Rewriting

APIs like the YouTube Data API authenticate via query parameters:

GET /youtube/v3/search?part=snippet&q=test&key=AIza...

The credential injector should:

  • Append the credential as a percent-encoded query parameter to the request URL
  • Handle URLs that already have query parameters (& vs ?)
  • Strip any existing instance of the parameter from the agent's request (prevent spoofing)

Use Case 2: Basic Authorization Header Encoding

Some APIs use HTTP Basic auth where the credential is username:password, base64-encoded:

Authorization: Basic dXNlcjpwYXNzd29yZA==

The credential injector should:

  • Accept a raw username:password credential value
  • Base64-encode it and inject as Authorization: Basic <encoded>
  • For rewriting scenarios: decode an existing Authorization: Basic header, perform credential substitution on the decoded content, then re-encode

Scope

  • In scope: Changes to the credential injection/L7 relay code in openshell-sandbox
  • Out of scope: Modifications to the network policy file spec or proto schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions