Repository navigation
Add isolated Azure Foundry provider for decision models - #11363
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Foundry credentials remain accessible through shared mounts and leak into the enclave proxy, while relative decision requests bypass run-limit accounting and CLI-supplied targets miss allowlisting.
4 open issues
What changed in this PR
Adds Azure Foundry support to AWF’s API-proxy architecture so decision-model and OpenAI-compatible calls can use sidecar-held credentials and usage accounting.
Changes:
- Adds an optional Foundry adapter on port
10005, preserving native request paths and bodies without startup inference probes. - Integrates credentials, agent routing, resource allowlisting, and sandbox network policy.
- Extends decision accounting coverage and documents authentication and pricing configuration.
| File | Description |
|---|---|
src/types/ports.ts |
Exports the Foundry proxy port. |
src/types/api-proxy-credential-options.ts |
Documents Foundry endpoints and credentials. |
src/services/foundry-provider.test.ts |
Covers host configuration and credential separation. |
src/services/api-proxy-service-split.test.ts |
Adds the Foundry endpoint expectation. |
src/services/api-proxy-env-config.ts |
Builds Foundry target and credential environment values. |
src/services/api-proxy-credential-env.ts |
Sets the agent’s Foundry base URL. |
src/services/agent-environment/excluded-vars.ts |
Excludes Foundry credentials from agent environment passthrough. |
src/microvm/network.test.ts |
Adds Foundry to network-policy expectations. |
src/config/sandbox-network-policy.json |
Defines the discrete Foundry sidecar port. |
src/config/network-policy.ts |
Parses and validates the Foundry port. |
src/config/network-policy.test.ts |
Verifies Foundry policy and port mappings. |
src/config/network-policy-validation.test.ts |
Updates the validation fixture with Foundry. |
src/commands/preflight.ts |
Resolves the Foundry resource for allowlisting. |
src/api-proxy-env-constants.ts |
Exports shared Foundry environment names. |
src/api-proxy-env-constants-sync.test.ts |
Verifies shared Foundry constants stay synchronized. |
src/api-proxy-config-domains.ts |
Adds the configured Foundry resource to allowed domains. |
docs/environment.md |
Explains Foundry setup, requests, and pricing. |
docs/auth-matrix.md |
Documents Foundry authentication and credential precedence. |
containers/api-proxy/upstream-log.test.js |
Covers native decision invocation recognition. |
containers/api-proxy/upstream-log.js |
Adds the native decision path to invocation classification. |
containers/api-proxy/server.target-ports.test.js |
Includes Foundry in custom target-port coverage. |
containers/api-proxy/server.network.test.js |
Updates endpoint reflection expectations. |
containers/api-proxy/server.models.test.js |
Includes Foundry in provider metadata expectations. |
containers/api-proxy/server.foundry.test.js |
Covers HTTP forwarding and persisted usage accounting. |
containers/api-proxy/providers/index.test.js |
Verifies Foundry adapter registration. |
containers/api-proxy/providers/index.js |
Registers the Foundry adapter factory. |
containers/api-proxy/providers/foundry.test.js |
Tests activation, authentication, and path handling. |
containers/api-proxy/providers/foundry.js |
Implements the optional Foundry adapter. |
containers/api-proxy/provider-env-constants.json |
Defines Foundry environment-variable names. |
containers/api-proxy/Dockerfile |
Exposes port 10005. |
Review effort: Max (auto)
| '/responses', | ||
| '/v1/decisions', | ||
| '/decisions', | ||
| '/providers/microsoft/v1/systemone', |
There was a problem hiding this comment.
Addressed in 81df020: max-runs accounting now checks the resolved upstream path, with regressions for both full-path and prefix-relative decision requests.
| const foundryApiKey = getConfigEnvValue(config, FOUNDRY_ENV.KEY) ?? process.env[FOUNDRY_ENV.KEY]?.trim(); | ||
| const foundryEntraToken = getConfigEnvValue(config, FOUNDRY_ENV.ENTRA_TOKEN) ?? process.env[FOUNDRY_ENV.ENTRA_TOKEN]?.trim(); |
There was a problem hiding this comment.
Addressed in 81df020: credential-bearing Foundry env files are masked via /dev/null overlays at exposed bind and chroot aliases; a compose-mount regression covers the /tmp aliases.
| ...(foundryApiKey && { [FOUNDRY_ENV.KEY]: foundryApiKey }), | ||
| ...(foundryEntraToken && { [FOUNDRY_ENV.ENTRA_TOKEN]: foundryEntraToken }), |
There was a problem hiding this comment.
Addressed in 81df020: the enclave API proxy now strips Foundry credentials, target, and base path regardless of its selected provider route; regression coverage verifies all four settings are absent.
| FOUNDRY_API_TARGET: additionalEnv?.['FOUNDRY_API_TARGET'] | ||
| ?? envFileValues['FOUNDRY_API_TARGET'] | ||
| ?? process.env.FOUNDRY_API_TARGET, |
There was a problem hiding this comment.
Addressed in 81df020: preflight parses options.env and uses the CLI Foundry target for allowlisting; the regression uses the raw env: ['FOUNDRY_API_TARGET=...'] options shape.
|
@copilot address all review feedback |
Co-authored-by: lpcox <[email protected]>
|
@copilot merge main and resolve conflicts |
…-support-decision-models # Conflicts: # src/services/api-proxy-env-config.ts
All four review items were addressed in
Merged |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 3d00fcf |
| port: 10005, | ||
| alwaysBind: false, | ||
| isEnabled: () => configured, | ||
| getAuthHeaders: () => entraToken |
| const entraToken = (env[FOUNDRY_ENV.ENTRA_TOKEN] || '').trim(); | ||
| const configured = !!rawTarget && !!(entraToken || apiKey); | ||
|
|
||
| return buildProviderAdapter({ |
|
@copilot address all review feedback |
Addressed both security findings in ac5790e: Foundry now requires an API key and ignores Entra tokens; only POST inference routes are forwarded, with HTTP/WebSocket enforcement before credential acquisition. Native and prefix-relative decisions remain supported. All 4,044 proxy tests and 59 host/enclave tests passed; build, lint, and secret scan passed. CodeQL was attempted but skipped analysis because the database is too large. |
…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]>
…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]>


Classification-only workflows currently require manual Foundry authentication and firewall configuration, outside AWF’s credential isolation and usage accounting. This adds an optional provider for native decision and OpenAI-compatible endpoints.
10005; preserves native Decision-1 payloads and paths without startup inference or model discovery.FOUNDRY_API_KEYorFOUNDRY_ENTRA_TOKENfrom the sidecar; rewrites agent routing and allowlists the configured resource hostname.maxRuns. AI-credit totals use configured catalog or fallback pricing.With Foundry credentials configured on the host, sandboxed callers need no authentication header: