Skip to content

RC1-1: AuthBridge Hop 1 — shared harness→LLM egress gateway (behind SH_AUTHBRIDGE) - #96

Merged
pdettori merged 9 commits into
rossoctl:mainfrom
pdettori:feat/rc1-1-hop1-llm-gateway
Jul 13, 2026
Merged

pdettori merged 9 commits into
rossoctl:mainfrom
pdettori:feat/rc1-1-hop1-llm-gateway

Conversation

@pdettori

Copy link
Copy Markdown
Member

RC1-1 — AuthBridge Hop 1: shared harness→LLM egress gateway (behind SH_AUTHBRIDGE)

Routes the harness's LLM egress through a shared AuthBridge reverse-proxy gateway (AB1) that injects the real Anthropic key, so the harness pod holds only a placeholder. Everything is behind the SH_AUTHBRIDGE feature flag (off by default); when off, the setup/leaf-smoke path is byte-for-byte unchanged. No harness runtime code change — this is deploy/config + manifest-shape tests + a live smoke.

What's here

  • deploy/knative/authbridge/ab1-deployment.yaml — AB1 Deployment + ClusterIP Service + config ConfigMap. AB1 is a reverse proxy to https://api.anthropic.com running the inbound chain inference-parser → ibac → static-inject: ibac is the control gate (static no_intent_policy), static-inject injects the real key as x-api-key from a mounted ab1-llm-cred secret (control runs before injection, so a denied request never gets a key).
  • deploy/knative/authbridge/harness-egress-ab1.yaml — tightened egress NetworkPolicy variant: the harness reaches only AB1 + DNS + Redis + apiserver, no public :443. Same NetworkPolicy name as the base so it overrides on apply; the base policy is untouched (applied only on the SH_AUTHBRIDGE path).
  • deploy/knative/setup-kind.sh — SH_AUTHBRIDGE wiring: create ab1-llm-cred (real key), repoint the harness llm-credentials to the placeholder + AB1 base-url, apply the AB1 stack. Flag-off keeps the existing secret logic verbatim.
  • deploy/knative/leaf-smoke.sh — SH_AUTHBRIDGE-gated Hop-1 claims: harness is secret-free, allow-path leaf completes (real key injected at AB1), and no_intent_policy: deny returns 403 at ibac before static-inject.
  • Tests — manifest-shape tests asserting the AB1 inbound-chain shape and the tightened egress (no public :443); packages/ibac-stub added to the CI per-package tsc list.

Validation

Live on Kind: SH_AUTHBRIDGE=1 LEAF_LIVE_SMOKE=1 leaf-smoke.sh → 13/13 PASS (secret-free + allow-path + deny-before-inject + all 9 standard leaf claims).

Depends on (AuthBridge image, kagenti-extensions)

The authbridge-proxy image needs the static-inject plugin (#655) and the reverse-proxy SSE/streaming fidelity fixes (#657, fixes #656). The RC1 image is built from those.

Scope

Behind SH_AUTHBRIDGE (off by default). RC1-2 (Hop 2, per-sandbox forward proxy) and RC1-4 (OCP) follow in subsequent PRs.

Assisted-By: Claude Code

pdettori added 8 commits July 10, 2026 23:05
Add deploy/knative/authbridge/ab1-deployment.yaml — the shared
harness->LLM reverse-proxy gateway for RC1-1 Hop 1. Runs the AuthBridge
authlib INBOUND pipeline (inference-parser -> ibac -> static-inject) in
front of https://api.anthropic.com, using the static-policy ibac gate
(no_intent_policy: allow, judge_inference: true) and static-inject keyed
by key_by: static / key: api.anthropic.com (not the inbound Host).
Inert by default: applied only when SH_AUTHBRIDGE=1, not wired into any
kustomization base.

Add an 'AB1 manifest' describe block to authbridge-manifests.test.ts
asserting the Deployment/Service/ConfigMap shape, the container image,
and the embedded config's inbound plugin chain order and static-inject
key config.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Adds deploy/knative/authbridge/harness-egress-ab1.yaml, a SH_AUTHBRIDGE=1-only
tightened egress NetworkPolicy (same name serverless-harness-egress, applied
by task 1g on the RC1 path to overwrite the base policy at apply time). It
replaces the base's external 0.0.0.0/0:443 rule with an AB1-scoped rule
(podSelector app=authbridge-ab1, TCP 8080) and keeps only the 6443 apiserver
port (drops 443), realizing Z2's 'harness reaches only AB1'.

The base deploy/knative/harness-egress-policy.yaml is left byte-for-byte
unchanged so the flag-off default keeps its existing external-LLM egress on
an enforcing CNI (OCP).

Adds a manifest-shape test describe block asserting: single NetworkPolicy
named serverless-harness-egress, same podSelector/policyTypes as the base,
an AB1 egress rule on TCP 8080, DNS (53) and apiserver (6443) rules present,
and explicitly no rule combining ipBlock 0.0.0.0/0 with port 443.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…-1 claims

- setup-kind.sh (1g): under SH_AUTHBRIDGE=1, require a real ANTHROPIC_API_KEY, create
  ab1-llm-cred (real key, keyed api.anthropic.com) and llm-credentials (AB1-PLACEHOLDER,
  base-url=http://authbridge-ab1:8080) so the harness pod is secret-free, then apply
  ibac-stub.yaml + authbridge/ab1-deployment.yaml + the tightened
  authbridge/harness-egress-ab1.yaml (overwrites the base NetworkPolicy by name) and wait
  for both Deployments to roll out. Flag-off path runs the original step-8 logic unchanged
  inside an else branch.
- leaf-smoke.sh (1f): under SH_AUTHBRIDGE=1, add three gated claims after Setup and before
  Claim 2 — H1-secret-free (harness env holds only the AB1 placeholder + base URL, no
  sk-ant-/sk-* leak), H1-allow (a leaf only completes if AB1 injected the real key), and
  H1-deny (flip AB1's no_intent_policy to deny, prove the leaf fails and AB1 rejects before
  injecting via its logs, then unconditionally revert to allow so Claims 2-8 run in allow
  mode). Entirely new block; no existing lines touched.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Add || true to the H1-deny probe dispatch so a curl timeout / connection
drop under set -euo pipefail cannot abort the script before the
unconditional ab1_set_policy allow revert, which would otherwise strand
AB1 in no_intent_policy:deny for the rest of this and future runs.

Also bail out of ab1_set_policy with return 1 (logging a warning) when the
ConfigMap read comes back empty, so a transient empty $cur can no longer
overwrite config.yaml with empty content and break AB1 after restart. Both
ab1_set_policy call sites gain || true so the new return-1 path cannot
itself abort the script under set -e.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…pefail)

The H1-deny claim never actually flipped AB1 to no_intent_policy: deny:
its ConfigMap read used an invalid jsonpath ({.data["config.yaml"]}),
returning empty so ab1_set_policy bailed. Also make the deny check robust:
prove deny-before-inject via a direct 403 probe (a leaf dispatch raced the
AB1 restart via harness connection pooling), poll with a longer wget timeout,
and neutralize wget's non-zero exit so pipefail doesn't drop a matched 403.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…ne 403 match)

Whole-branch review nits: the H1-deny comment said 'outbound chain' (the
chain is under pipeline.inbound); and the deny probe matched the bare
substring '403' — tighten to the SSE status line 'HTTP/x 403' to avoid a
false positive from e.g. a Content-Length containing 403.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@pdettori pdettori left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Summary

(Posting as a COMMENT review — GitHub blocks self-approval; this would otherwise be an APPROVE.)

Clean, well-scoped RC1-1 "Hop 1" AuthBridge gateway. The in-cluster reverse-proxy (authbridge-ab1) holds the real Anthropic key and injects it per-request, so the harness carries only a placeholder + AB1's base URL.

Verified:

  • Correctly feature-flagged — SH_AUTHBRIDGE defaults to 0 everywhere (${SH_AUTHBRIDGE:-0}); new manifests are inert (not wired into any kustomization base); the base egress policy stays byte-for-byte unchanged so the flag-off default is preserved.
  • No egress-policy overwrite conflict on Kind — the "applied after base" comment is forward-looking for the OCP path (task 1g). setup-kind.sh applies service.yaml directly (not via kustomize), so the tightened AB1 variant is the sole egress policy on Kind. kindnet doesn't enforce egress anyway; OCP is the live gate, per the manifest comment.
  • Referenced pre-existing files (ibac-stub.yaml, harness-egress-policy.yaml, packages/ibac-stub) all exist on the branch.
  • Defensive leaf-smoke deny path — probe-based 403 assertion (deny-before-inject proof, since ibac runs before static-inject), || true pipefail neutralization for BusyBox wget, and always-revert-to-allow regardless of outcome.

Areas reviewed: Shell, YAML/K8s manifests, CI, TypeScript tests
Agent/IDE config (.claude/.vscode): none
Commits: 8, all signed-off (DCO ✅)
CI status: passing (all 10 checks green)

Two nit-level observations inline — neither blocks merge.

Assisted-By: Claude Code

Comment thread deploy/knative/leaf-smoke.sh Resolved
The AB1 manifests are pinned to namespace: default, but the Hop-1 AuthBridge ops
run via -n "$NS". If NS were overridden, those kubectl calls would target the
wrong namespace and silently no-op through the || true guards, making the H1
claims fail confusingly. Assert NS=default up front with a clear message.
Addresses review nit on rossoctl#96.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit 9c14b13 into rossoctl:main Jul 13, 2026
10 checks passed
@pdettori
pdettori deleted the feat/rc1-1-hop1-llm-gateway branch July 13, 2026 02:56
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