Skip to content

Add opt-in trusted LLM service routing and secret headers - #11345

Merged
lpcox merged 5 commits into
mainfrom
copilot/awf-define-proxy-support
Nov 9, 2026
Merged

lpcox merged 5 commits into
mainfrom
copilot/awf-define-proxy-support

Conversation

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Custom model targets do not establish a credential-isolated service-proxy contract. This change adds trusted HTTPS intermediaries behind AWF’s API proxy and defines the separate native-telemetry handoff.

  • Routing and policy

    • Anthropic/OpenAI requests follow agent → AWF api-proxy → Squid → trusted service → provider.
    • Preserve model, budget, invocation, and destination checks without widening agent egress.
    • Require verified HTTPS/443; reject conflicting targets, redirects, alternate-target fallback, and unsupported runtimes/transports.
  • Credential handling

    • Map supplemental headers to runner environment variable names; inherit values only into the trusted sidecar.
    • Reject reserved headers and environment controls; exclude secrets from agent environments, reflection, public configuration, and logs.
    • AWF retains provider authentication. The service operator is explicitly trusted with those credentials and must not echo them.
  • Contract and coverage

    • Add schema validation, focused proxy/service integration coverage, and a standalone recipe.
    • Document topology limits, release gating, and gh-aw ownership.
    • Leave native OTLP ingestion to the separate gateway work; a trusted default collector may own fan-out and mutation.
apiProxy:
  targets:
    anthropic:
      trustedService:
        endpoint: https://llm-gateway.example.net/anthropic
        secretHeaders:
          x-corporate-token: CORPORATE_LLM_TOKEN

CORPORATE_LLM_TOKEN names a runner environment variable—not a literal secret.

@lpcox
lpcox marked this pull request as ready for review November 9, 2026 04:07
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 04:07
Copilot AI changed the title [WIP] Define trusted service-proxy support for LLM secret headers Add opt-in trusted LLM service routing and secret headers Nov 9, 2026
Copilot AI requested a review from lpcox November 9, 2026 04:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Non-empty secretHeaders crash Compose rendering before startup, and enclave proxies inherit trusted-service routes and secrets while bypassing Squid.

5 open issues
What changed in this PR

Introduces opt-in trusted HTTPS intermediaries for Anthropic and OpenAI through AWF’s credential-isolated API proxy, with supplemental headers sourced from runner environment variables.

Changes:

  • Adds configuration, validation, sidecar secret inheritance, and agent-environment filtering.
  • Extends provider routing, proxy-scoped Squid rules, TLS enforcement, and redirect handling.
  • Adds focused coverage and documents standalone setup, topology limits, release requirements, and the separate native-telemetry handoff.
File Description
src/​types/​squid.ts Adds proxy-only upstream admission metadata.
src/​types/​api-proxy-credential-options.ts Exposes trusted-service credential options.
src/​trusted-service.ts Implements validation, routing, and environment-isolation helpers.
src/​trusted-service.test.ts Covers configuration, policy, and secret isolation.
src/​squid/​policy-manifest.ts Represents proxy-only HTTPS admission rules.
src/​squid/​api-proxy-upstreams.ts Generates scoped CONNECT and TLS-splice rules.
src/​services/​api-proxy-service-config.ts Adds runner-secret environment passthrough entries.
src/​services/​api-proxy-env-config.ts Builds trusted targets and upstream admission metadata.
src/​services/​agent-environment/​excluded-vars.ts Excludes configured secret variable names.
src/​services/​agent-environment/​environment-builder.ts Filters secrets after environment assembly.
src/​config-mapper.ts Maps file configuration into trusted-service options.
src/​config-file.ts Adds target types and semantic validation.
src/​compose-generator.ts Applies final agent-environment secret filtering.
src/​commands/​resolve-credentials.ts Propagates trusted-service settings.
src/​commands/​preflight.ts Validates trusted services during domain resolution.
src/​awf-config-schema.json Adds runtime schema definitions and conflict constraints.
README.md Links the trusted-service guide.
docs/​awf-config.schema.json Defines the public trusted-service configuration schema.
docs/​awf-config-spec.md Documents trust, setup, topology, and telemetry boundaries.
containers/​api-proxy/​upstream-http.test.js Covers redirect cancellation and cleanup.
containers/​api-proxy/​upstream-http.js Adds trusted-request TLS, redirect, and fallback controls.
containers/​api-proxy/​trusted-service.test.js Exercises adapters, verified TLS routing, and policy denials.
containers/​api-proxy/​trusted-service.js Validates sidecar settings, injects headers, and tracks redaction values.
containers/​api-proxy/​server-factory.js Rejects trusted-service WebSocket upgrades.
containers/​api-proxy/​request-headers.js Replaces spoofed headers and suppresses credential previews.
containers/​api-proxy/​proxy-request.js Marks trusted-service requests for downstream handling.
containers/​api-proxy/​model-discovery.js Requires verified TLS for trusted discovery requests.
containers/​api-proxy/​logging.js Redacts known secrets in nested log fields.
containers/​api-proxy/​Dockerfile Includes the trusted-service helper in the image.
containers/​api-proxy/​deprecated-header-tracker.js Protects injected headers from learned stripping.
containers/​api-proxy/​adapter-factory.js Integrates trusted targets and supplemental authentication headers.

Review effort: Max (auto)

if (Object.prototype.hasOwnProperty.call(proxyService.environment, name)) {
throw new Error('trustedService secret environment name conflicts with sidecar configuration');
}
proxyService.environment[name] = null;
Comment thread src/trusted-service.ts
Comment on lines +102 to +104
if (config.containerRuntime && !['docker', 'runc'].includes(config.containerRuntime)) {
throw new Error('trustedService currently supports only the ordinary Docker runtime');
}
? (oidcContext) => getAuthHeaders({ ...config, ...headerBuilders, ...oidcContext })
: undefined,
});
if (trustedService) adapter.trustedService = true;
Comment thread src/commands/preflight.ts Resolved
Comment thread src/trusted-service.ts
Comment on lines +105 to +106
const authType = config.authType ?? getConfigEnvValue(config, 'AWF_AUTH_TYPE') ?? process.env.AWF_AUTH_TYPE;
const authProvider = config.authProvider ?? getConfigEnvValue(config, 'AWF_AUTH_PROVIDER') ?? process.env.AWF_AUTH_PROVIDER;
@lpcox

lpcox commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed the review findings in commit 5892a7d, including regression coverage for each reported issue.

@lpcox
lpcox enabled auto-merge (squash) November 9, 2026 05:57
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11345 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit 1ca2bbd

@lpcox
lpcox disabled auto-merge November 9, 2026 06:05
@lpcox

lpcox commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

…e validation'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lpcox lpcox removed the ready-for-aw label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix the failiing ci check and address all review feedback https://github.com/github/gh-aw-firewall/actions/runs/42569502676/job/129005520024?pr=11345

Added the missing trusted-service runtime fixture asset, fixing the Root Unit Tests failure. The TLS-test override removal is in 8321b36; the fixture fix is in f279b28. Targeted tests and the build pass.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.82% 93.83% 📈 +0.01%
Statements 92.36% 92.37% 📈 +0.01%
Functions 93.02% 93.05% 📈 +0.03%
Branches 86.70% 86.74% 📈 +0.04%
📁 Per-file Coverage Changes (4 files)
File Lines (Before → After) Statements (Before → After)
src/services/api-proxy-service-config.ts 100.0% → 97.6% (-2.44%) 100.0% → 97.6% (-2.39%)
src/config-file.ts 100.0% → 97.6% (-2.39%) 100.0% → 97.8% (-2.23%)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 90.1% → 89.8% (-0.29%)
src/services/api-proxy-env-config.ts 99.0% → 99.1% (+0.04%) 99.1% → 98.3% (-0.80%)
✨ New Files (1 files)
  • src/trusted-service.ts: 98.6% lines

Coverage comparison generated by scripts/ci/compare-coverage.ts

@lpcox
lpcox merged commit dabced8 into main Nov 9, 2026
44 of 46 checks passed
@lpcox
lpcox deleted the copilot/awf-define-proxy-support branch November 9, 2026 15:35
github-actions Bot added a commit that referenced this pull request Nov 14, 2026
- Actions OIDC runtime variables are forwarded to the sidecar for
  GH_AW_OTLP_WORKLOAD_IDENTITY as well as github-oidc (buildOtelEnv).
- Native OpenAI WIF enables agent routing via isOpenAiOidcConfigured();
  the Azure OIDC caveat now states this explicitly.
- Document the trustedService secret-header contract (#11345) in the
  auth matrix, linking the normative spec section 9.10.

Co-authored-by: Copilot <[email protected]>
github-actions Bot added a commit that referenced this pull request Nov 14, 2026
…ce in NET-003

Adds provenance for PR #11345 (trusted LLM service sidecar upstream, exact
HTTPS/443 proxy-only) and PR #11363 (Azure Foundry target on the same exact
custom-port sidecar ACL path) to NET-003.

Generated consumers are intentionally not regenerated here; trusted CI or a
reviewer runs diagnostics:render.

Co-authored-by: Copilot <[email protected]>
lpcox added a commit that referenced this pull request Nov 14, 2026
…d-service docs (#11572)

* docs: fix auth OIDC forwarding and OpenAI routing docs

- Actions OIDC runtime variables are forwarded to the sidecar for
  GH_AW_OTLP_WORKLOAD_IDENTITY as well as github-oidc (buildOtelEnv).
- Native OpenAI WIF enables agent routing via isOpenAiOidcConfigured();
  the Azure OIDC caveat now states this explicitly.
- Document the trustedService secret-header contract (#11345) in the
  auth matrix, linking the normative spec section 9.10.

Co-authored-by: Copilot <[email protected]>

* docs: resolve stale OIDC forwarding guidance

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: lpcox <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
lpcox added a commit that referenced this pull request Nov 14, 2026
…ry upstream provenance in NET-003 (#11576)

* docs(diagnostics): cite trusted-service and Foundry upstream provenance in NET-003

Adds provenance for PR #11345 (trusted LLM service sidecar upstream, exact
HTTPS/443 proxy-only) and PR #11363 (Azure Foundry target on the same exact
custom-port sidecar ACL path) to NET-003.

Generated consumers are intentionally not regenerated here; trusted CI or a
reviewer runs diagnostics:render.

Co-authored-by: Copilot <[email protected]>

* docs(diagnostics): refresh generated NET-003 consumers

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: lpcox <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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.

[awf] Define trusted service-proxy support for LLM secret headers and agent telemetry

4 participants