Repository navigation
Present a client certificate on auction providers that set mtls - #1667
ChristianPavilonis wants to merge 10 commits into
Conversation
Pin every EdgeZero dependency to v0.0.12-rc-identity.202611.1, which adds outbound client identities (edgezero#524) on top of the portable record providers (edgezero#522). Trusted Server builds and passes its suites against the tag without source changes. The lockfile also re-resolves a few transitive dependencies that EdgeZero's new crates share.
An auction provider with `mtls = true` now presents the `auction-providers` client identity on its OpenRTB requests. The identity is declared in edgezero.toml and bound to the default config and secret stores, and the Fastly app returns the baked manifest from `Hooks::manifest` so EdgeZero builds its identity policy. - `ProviderConfig.mtls` defaults to false and is omitted when false. Plan compilation rejects it with a non-https endpoint, and the Fastly backend bound counts it as its own backend. - Axum, Cloudflare and Spin refuse to start with an mtls provider, and `ts config push` and `diff` refuse such a config for those adapters. - A refused identity is that provider's transport failure, with no retry without the certificate. `outbound_error` now attaches the identity name and reason, so the auction log says why.
…eroy A loopback mock PBS requires a certificate from its own client CA. A prebid-server provider with mtls gets its bid through, the same provider without mtls fails the handshake, and a missing key fails before any connection with the identity name and reason in the log. A plain loopback bidder keeps its bid in every case.
Each region can require a client certificate at its HTTPS listener by setting a CA bundle bucket and key. The listener keeps its ACM server certificate and the CIDR allowlist stays. Optional per-region buckets enable ALB connection logs. The listener always renders `mutual_authentication`, with mode off when the inputs are unset, and the load balancer always renders `connection_logs`, because the AWS provider keeps a removed block's setting. The trust store uses create_before_destroy so Terraform turns the listener off before deleting the store. Adds a bash and openssl development certificate script with a Node test, and documents CA ownership, rollout one region at a time, key-first rotation, CA rotation and rollback in the README, RUNBOOK and DEPLOYMENT_PLAN.
Adds a Provider mTLS section to the auction orchestration guide: the setting, certificate ownership and the offline CA flow, the three Fastly store entries, the Secret Store read budget, key-first rotation, rollback, and troubleshooting by the logged reason. Adds the field to the configuration reference and example config, the new errors to the error reference, a pointer from the Prebid guide, and commented local entries to fastly.toml and the Viceroy template.
…ero d063a8e7 Brings Aram's identity integration chain merge-forward and b181544 (Accept any Fastly EC store link name at startup). EdgeZero moves from tag v0.0.12-rc-identity.202611.1 to rc/identity d063a8e7, which contains that tag (client identities) and the Fastly SDK 0.13.3 upgrade. error-reference.md keeps both the base's wording and this PR's client-identity hint.
Rewriting the auction-providers key and chain in place fails every mtls auction until both writes reach a POP: the chain comes from the Config Store on each request, the key from the Secret Store whenever a backend registers, and the stores propagate independently. Staging measured about three minutes of failures for a key-first rotation. Declare two client identities, auction-providers-blue and auction-providers-green, and select one with [auction] mtls_slot (default blue, omitted from serialized configs). An operator fills the idle slot, waits for it to propagate, then pushes the slot switch; every request reads one complete pair or the other, so no auction pairs a new key with an old chain. - MtlsSlot in the auction plan and AuctionConfig, threaded into compile_client_identity - edgezero.toml declares both identities - Viceroy case: green slot alone bids with mtls_slot = green - Guide, configuration and error references, PBS runbook, example configs and the design spec describe slot rotation
… providers that set mtls Source: feat/1650-auction-provider-mtls at eaa2b3e.
prk-Jr
left a comment
There was a problem hiding this comment.
Summary
Adds per-provider mtls = true so planned auction providers present an EdgeZero client identity (two rotation slots, auction-providers-blue/-green) on Fastly, with Axum/Cloudflare/Spin and ts config push/diff for those adapters failing closed, plus optional ALB verify mode in the PBS AWS example. The runtime design is sound: the chain and hosts live in the Config Store and the key only in the Secret Store, the identity is set only on mtls providers, EdgeZero's per-identity hosts list keeps the certificate off other origins, refusals fail just that provider as transport with no retry without the certificate, the diagnostic attachment carries the identity name and reason but no PEM, and server certificate verification is unchanged. One CI gate is red because of the example config, and one ordering-sensitive doc step lost its list item.
2 of the inline comments below carry a one-click GitHub
suggestion. Use Commit suggestion (or Add suggestion to batch) to apply them.
Blocking
🔧 wrench
mtls_slotcomment block breaks the template-cache harness, so thecargo testjob fails — see inline attrusted-server.example.toml:601
Non-blocking
⛏ nitpick
- Rollout step 4 is merged into the following paragraph — see inline at
docs/guide/auction-orchestration.md:978 - Doc comment still names the single pre-slot
auction-providersidentity — see inline atcrates/trusted-server-adapter-fastly/src/app.rs:1794
Cross-cutting / body-level findings
- 📝 PR description predates the slot rotation commit. The summary, the
plan.rsrow and the rotation-order bullet still describe oneauction-providersidentity with an in-place key-then-chain rewrite. The head commit replaces that with blue/green slots and a guide that says never to rewrite the active slot in place. Worth refreshing so the merge commit and reviewers of #1674 see the current design.
CI Status
- cargo test: FAIL (introduced here; passes on the base commit.
scripts/template-cache-local-test.sh esiexits withexpected one auction timeout replacement target, see the inline comment) - local-provider-image: FAIL (pre-existing; the base commit
afc4f5dfails the same job withinvalid-envelope must not listen, unrelated to this PR) - cargo fmt: PASS
- cargo test (axum native): PASS
- cargo test (cross-adapter parity): PASS
- cargo test (ts CLI, native) (ubuntu-latest): PASS
- cargo test (ts CLI, native) (macos-latest): PASS
- cargo check (cloudflare native + wasm32-unknown-unknown): PASS
- cargo check/build/test (spin native + wasm32-wasip1): PASS
- integration tests: PASS
- integration tests (Fastly EC lifecycle): PASS
- browser integration tests: PASS
- HTML EOF runtime (Fastly): PASS
- health-startup (axum / cloudflare / fastly / spin): PASS
- worker-deadlines (cloudflare / spin): PASS
- PBS Terraform and Compose checks: PASS
- ts dev lint domains (changed lines): PASS
- vitest, format-typescript, format-docs: PASS
- Native provider acceptance script, Fastly response diff script, release scripts, docs-proposal scripts, CI Node pin guard, CLAUDE.md symlink guard: PASS
- prepare integration artifacts, record-provider-image, stock-celld-records, trace runtime and browser acceptance: PASS
| # Client identity slot that providers with `mtls = true` present: "blue" | ||
| # (default) or "green". Rotate by provisioning the idle slot's | ||
| # auction-providers-<slot>.* entries, waiting for them to propagate, then | ||
| # switching this. Binaries older than this setting reject "green". | ||
| # mtls_slot = "blue" | ||
| timeout_ms = 2000 |
There was a problem hiding this comment.
🔧 wrench: This comment block sits between sanitize_creatives = false and timeout_ms = 2000, and the cargo test CI job runs scripts/template-cache-local-test.sh, which rewrites the example config with replace_once(s, 'sanitize_creatives = false\ntimeout_ms = 2000', ...). The literal no longer occurs, so the harness exits before starting the server:
==> Generating stub config (mode: esi)
expected one auction timeout replacement target
That is the cargo test failure on this head; the same job passes on the base commit. I reproduced it by running the harness's config generator against this file (exit 1) and against the change below (generates the config).
Moving the comment below timeout_ms keeps the docs and restores the anchor:
| # Client identity slot that providers with `mtls = true` present: "blue" | |
| # (default) or "green". Rotate by provisioning the idle slot's | |
| # auction-providers-<slot>.* entries, waiting for them to propagate, then | |
| # switching this. Binaries older than this setting reject "green". | |
| # mtls_slot = "blue" | |
| timeout_ms = 2000 | |
| timeout_ms = 2000 | |
| # Client identity slot that providers with `mtls = true` present: "blue" | |
| # (default) or "green". Rotate by provisioning the idle slot's | |
| # auction-providers-<slot>.* entries, waiting for them to propagate, then | |
| # switching this. Binaries older than this setting reject "green". | |
| # mtls_slot = "blue" |
| 3. Push the config with `mtls = true`. With `reusable-sandbox`, a running | ||
| sandbox keeps its old settings until it is recycled, so allow for that | ||
| before the next step. | ||
|
|
||
| `mtls_slot = "green"` follows the same rule: versions without the field reject | ||
| it, so deploy a version that supports it before the first push that sets it. | ||
| The default `blue` is omitted from the stored config. 4. Turn on client verification at the provider, and confirm auctions succeed. | ||
| The PBS AWS example does this one region at a time. |
There was a problem hiding this comment.
⛏ nitpick: The mtls_slot note was placed between list items 3 and 4, so Prettier folded step 4 into the paragraph and it renders as ...omitted from the stored config. 4. Turn on client verification.... This list exists because "the order matters", so step 4 should stay a numbered step. Putting the note after the list fixes it (Prettier check passes on the result):
| 3. Push the config with `mtls = true`. With `reusable-sandbox`, a running | |
| sandbox keeps its old settings until it is recycled, so allow for that | |
| before the next step. | |
| `mtls_slot = "green"` follows the same rule: versions without the field reject | |
| it, so deploy a version that supports it before the first push that sets it. | |
| The default `blue` is omitted from the stored config. 4. Turn on client verification at the provider, and confirm auctions succeed. | |
| The PBS AWS example does this one region at a time. | |
| 3. Push the config with `mtls = true`. With `reusable-sandbox`, a running | |
| sandbox keeps its old settings until it is recycled, so allow for that | |
| before the next step. | |
| 4. Turn on client verification at the provider, and confirm auctions succeed. | |
| The PBS AWS example does this one region at a time. | |
| `mtls_slot = "green"` follows the same rule: versions without the field reject | |
| it, so deploy a version that supports it before the first push that sets it. | |
| The default `blue` is omitted from the stored config. |
| /// Returns the repository's `edgezero.toml`, baked at build time. | ||
| /// | ||
| /// [`App::from_router`] builds the outbound client-identity policy from this hook, so | ||
| /// auction providers with `mtls = true` can present the `auction-providers` identity. The |
There was a problem hiding this comment.
⛏ nitpick: Since the slot commit there is no auction-providers identity, only auction-providers-blue and auction-providers-green.
| /// auction providers with `mtls = true` can present the `auction-providers` identity. The | |
| /// auction providers with `mtls = true` can present the active slot's identity. The |
Summary
mtls = truepresents a TLS client certificate, theauction-providersidentity, on its OpenRTB requests. On Fastly, EdgeZero takes the chain and the allowed hosts from the Config Store and the key from the Secret Store. Axum, Cloudflare and Spin refuse such a config at startup and ints config push/diff.v0.0.12-rc-identity.202611.1, which adds outbound client identities (Add outbound mTLS client identities, implemented on Fastly edgezero#524).Stacked on #1540.
Changes
Cargo.toml,Cargo.lock,crates/trusted-server-adapter-axum/Cargo.tomlv0.0.12-rc-identity.202611.1. No source changes needed.edgezero.tomlauction-providersclient identity and listsoutbound-client-identityas optionalcrates/trusted-server-core/build.rs,src/edgezero_manifest.rsedgezero.tomlas JSON, as EdgeZero'sapp!does, for adapters that implementHooksby handcrates/trusted-server-adapter-fastly/src/app.rsHooks::manifest()returns the baked manifest, so EdgeZero builds the identity policy. Without it every identity request fails as undeclared.crates/trusted-server-core/src/auction/plan.rsProviderConfig.mtls(default false, omitted when false);ProviderPlan.client_identity; https required;mtlsjoins the Fastly backend-bound tuple;reject_auction_mtlscrates/trusted-server-core/src/auction/provider.rsOutboundRequestcrates/trusted-server-core/src/outbound.rsoutbound_errorattaches the identity name and reason, since theEdgeErroritself is attached opaquelycrates/trusted-server-adapter-{axum,cloudflare,spin}/src/app.rsmtlscrates/trusted-server-cli/src/checked_app_config.rsts config push/difffor non-Fastly adapters rejectmtlscrates/trusted-server-core/src/test_support/scripted_client.rs,test_support.rsmtlsprovider fixturecrates/trusted-server-integration-tests/deploy/pbs-example/,.github/workflows/pbs-example.ymldocs/guide/*,trusted-server.example.toml,fastly.toml.claude/skills/planning-prebid-aws/references/terraform.mddocs/superpowers/{specs,plans}/2026-11-24-auction-provider-mtls*Things worth a reviewer's attention:
transportwith no bids, and the warning names the identity and the reason, such asprivate key is missing. A key that does not match the certificate fails later:launch_failedif Fastly rejects the backend registration (if every routed provider fails to launch, direct/auctionreturns 502), ortransportif the handshake fails. Which of the two production Fastly does is for the staging run. In every case the request is never retried without the certificate.ProviderConfigrejects unknown fields and Fastly loads the config before the app, so a config withmtlsbreaks every request an older binary serves. Deploy this version first, then pushmtls; roll back in reverse. The guide, spec and RUNBOOK say so.X-Amzn-Mtls-Clientcert-*headers, and connection logs record the subject, serial and source IP. The guide asks for a service subject without personal information.mutual_authentication(offwhen unset), and the load balancer always rendersconnection_logs, because provider 6.64.0 keeps a removed block's setting. The trust store usescreate_before_destroy, so the listener is switched off before the trust store is deleted.Closes
Closes #1650
GitHub closes issues only for PRs into the default branch, so #1650 will be closed by hand when this reaches
main. The staging run against a real ALB happens after merge and is recorded on #1650.Spec
Spec:
docs/superpowers/specs/2026-11-24-auction-provider-mtls-design.md, with its review log. Plan:docs/superpowers/plans/2026-11-24-auction-provider-mtls.md.Test plan
cargo test-fastly(4,180 passed) andcargo test-fastly-reuseon stock Viceroy 0.21.0cargo test-axum,cargo test-cloudflare,cargo test-spin,cargo check-cloudflare,cargo check-spincargo test -p trusted-server-core --test template_build_digest,cargo test -p trusted-server-cli(host target)cargo clippy-fastly,clippy-axum,clippy-cloudflare,clippy-cloudflare-wasm,clippy-spin-native,clippy-spin-wasm,clippy-cli, and clippy for the integration-tests cratecargo fmt --all -- --checknpm run format,npm run lint,npm run build, and Prettier for Markdown outsidedocs/ts dev lint domains --changed-vsthe stack basecargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1./scripts/integration-tests.sh: 81 passed in the first run. The 15 Cloudflare cases failed only because the Workers bundle was not built and, withoutCI,wranglerused the localwrangler.toml. Afterbuild.shand withCI=1, all 20 Cloudflare cases andtest_all_combinationspassed.terraform fmt, readonly init, validate and both mocked suites (root 8, regional 11, including verify on to off), both Node tests, lock files unchangedChecklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)