Skip to content

feat(gateway,helm,agents): secretless HTTP APIs with method/path policy - #125

Merged
devopssquaddev merged 4 commits into
mainfrom
feat/platform-credential-injection
Nov 16, 2026
Merged

devopssquaddev merged 4 commits into
mainfrom
feat/platform-credential-injection

Conversation

@devopssquaddev

Copy link
Copy Markdown
Owner

Summary

Agents can call plain HTTP APIs (GitHub, Stripe, internal REST services) without holding the API credential. The gateway injects it and allows or denies each call by method and path.

  • Platform chart: workspace.tools.httpApis[] renders one gateway relay per API ({release}-api-{name}):

    • an ExternalName Service to the Envoy dataplane;
    • an HTTPRoute on the relay's own hostnames to an FQDN Backend, plus BackendTLSPolicy for https;
    • a URLRewrite that sets the upstream host;
    • a credentialInjection HTTPRouteFilter that reads the credential from a Secret, and a regex prefix rewrite when the URL has a path;
    • a SecurityPolicy with gateway-key apiKeyAuth and first-match method/path CEL authorization (defaultAction: Deny).

    Invalid entries fail at render time, and the contract ConfigMap publishes HTTP_APIS.

  • Agent chart: platform.httpApis gives the sidecar ZELKOR_API_UPSTREAMS and the runtime ZELKOR_API_<NAME>_URL, both loopback URLs. The credential never enters the pod.

  • Sidecar: new route /run/active/api/{name}/*. It forwards with the gateway key, strips the runtime's Authorization and identity headers, and refuses unknown APIs or calls made with no active run. Each call gets an http {METHOD} {name} span and an http_api log line.

  • CLI: zelkor deploy / deploy -f pass the platform's APIs to every sidecar-wrapped agent.

  • Docs: new page docs/http-apis.md.

  • Example: examples/perimeter-github, an agent with its own Dockerfile that reads GitHub through the relay. Writes are refused at the gateway, and the pod has no token.

MCP servers already had both pieces: extraBackends[].apiKey injects their credential and workspace.tools.policy.deny restricts tools.

Verification

  • Offline: 363 chart, sidecar, CLI and docs tests plus the example's tests pass. The rendered HTTPRouteFilter and SecurityPolicy validate against the Envoy Gateway v1.10.0 CRD schemas.
  • Live on a kind lab (full profile, --egress-only agent, new sidecar image):
    • All relay objects are Accepted.
    • The injected credential replaces the runtime's Authorization; the gateway key and X-Tenant-ID never reach the API.
    • A deny rule listed before an allow rule wins (403), and paths with no matching rule get 403. No key or a wrong key gets 401.
    • Path tricks (.., %2e%2e, %2f, //) don't get past the rules.
    • HTTPS to api.github.com works.
    • The agent pod can't reach the API or GitHub directly.
    • A rotated Secret is used within about 3 s with no restart.
    • Spans appear under the run root.
  • Fixed after the first live run (separate commit): a Host rewrite (GitHub answered 400 to the relay's hostname), the prefix slash (/base + /x became /basex), and the client-ID header no longer reaching the upstream.
  • Example live tests: pass on two consecutive runs. Reads got 200, every attempted write got 403, and there were no ERROR logs.

Notes

  • This needs a sidecar image rebuild, so it ships in the next MINOR release.
  • It overlaps with the CI verification PR in values.yaml, values.schema.json and docs/README.md. Whichever merges second needs a small rebase and a schema regeneration.

🤖 Generated with Claude Code

devopssquaddev and others added 4 commits November 16, 2026 17:37
Agents can call plain HTTP APIs without holding the API credential.
workspace.tools.httpApis[] renders, per API, a gateway relay
({release}-api-{name}): ExternalName Service to the Envoy dataplane,
HTTPRoute on its own hostnames to an FQDN Backend (+ BackendTLSPolicy for
https), an HTTPRouteFilter credentialInjection from a Secret, and a
SecurityPolicy with consumer-key apiKeyAuth plus first-match method/path
CEL authorization (default Deny). Invalid entries fail render.

- contract ConfigMap publishes HTTP_APIS
- zelkor-agent: platform.httpApis -> sidecar ZELKOR_API_UPSTREAMS and
  runtime ZELKOR_API_<NAME>_URL (loopback)
- zelkor-sidecar: /run/active/api/{name}/* relays with the consumer key,
  strips runtime identity headers, refuses unknown APIs or no active run
- zelkor CLI: deploy / deploy -f pass the platform's APIs to every
  sidecar-wrapped agent
- docs: http-apis.md how-to

Rendered HTTPRouteFilter/SecurityPolicy validated against the Envoy
Gateway v1.10.0 CRD schemas. Live gateway verification still pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by the live gateway run:
- set URLRewrite.hostname to the API host; virtual-hosted APIs (GitHub)
  answered 400 to the relay's own hostname
- URL path prefix via a regex rewrite of the leading "/": Envoy Gateway
  trims the slash of ReplacePrefixMatch on "/" (/base + /x -> /basex)
- no forwardClientIDHeader on API relays, so the gateway's caller id
  never reaches a third-party API
- sidecar http_api log names the method and API in the message

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ing the token

A bring-your-own Pydantic AI agent on the stock runtime image with two
plain Python tools (github_read, github_write) that call
$ZELKOR_API_GITHUB_URL. The platform overlay relays api.github.com,
allows GET /repos/ and GET /search/issues, and denies everything else;
the token stays in a platform-namespace Secret.

- README: business case, deploy, "what you'll see" table, policy edits
- offline tests: overlay renders a read-only relay; tools send no token,
  slim issue lists, report a gateway 403 as text
- live tests: read succeeds through the relay, an attempted PATCH gets
  403 at the gateway, the agent pod has no token and no direct route
- runtimes README: perimeter deploy note (--tools aigateway)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new HTTP APIs page pushed the llms.txt index to ~2045 tokens (limit
2000). Applies the same description cuts as the release-verification
branch (identical edits merge cleanly) plus a few more, so the index stays
under budget on this branch (~1926) and after both branches merge (~1981).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ a447ed4 2026-11-16T18:17:51.233Z Visit the dashboard ↗

@devopssquaddev
devopssquaddev merged commit a945bfe into main Nov 16, 2026
11 checks passed
devopssquaddev added a commit that referenced this pull request Nov 17, 2026
…ases) (#128)

* chore(platform): release 2.5.0 (secretless HTTP APIs, verifiable releases)

MINOR: new Helm contracts workspace.tools.httpApis (#125) and
security.imageVerification (#126).

- charts, first-party image tags, Zelkor Dockerfile bases and example
  charts at 2.5.0; example chart dependencies rebuilt
- profiles/values-production.yaml at tag 2.5.0 with empty digests: the
  release workflow builds and signs the images from the tag, so digests
  are pinned in a follow-up PR from the signed release
- test_production_overlay_uses_semver_not_dev accepts the release tag
  or a digest, never :dev
- THIRD_PARTY_NOTICES: 2.5.0 row (no third-party pin changes)

scripts/release/check_version.py v2.5.0-ce passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test,release: S-gate evidence for v2.5.0-ce; trace test uses the tenant mapping

- release-evidence/v2.5.0-ce/s-gate.junit.xml: S-gate run against the
  release candidate (101 tests, 0 failures, 11 environment skips);
  re-runs and the tool-policy overlay cases merged in, file paths removed.
  release.yml builds the published fail-closed matrix from it
  (PASS 6, GAP 1: DNS egress has no S-test yet).
- test_agent_trace compared the trace user with the test label; with real
  IdP tokens the platform tenant differs, so it now uses tenant_of().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant