Add a pluggable Edge Cookie provider seam with the built-in HMAC provider - #1043
Open
jwrosewell wants to merge 1 commit into
Open
Add a pluggable Edge Cookie provider seam with the built-in HMAC provider#1043jwrosewell wants to merge 1 commit into
jwrosewell wants to merge 1 commit into
Conversation
This was referenced Aug 19, 2026
…ider First slice of the PR 838 decomposition (one PR per feature, Edge Cookie provider first). Introduces the EdgeCookieProvider trait and routes Edge Cookie minting, cookie read-back, and KV keying through the selected provider, so a vendor identifier round-trips verbatim instead of being dropped by the built-in shape check. - [ec] provider selector with per-provider [ec.providers.<key>] blocks; the hmac block carries the passphrase that previously lived on [ec]. With no provider selected, no Edge Cookie is generated. - Built-in provider: hmac (HMAC over client IP, preserves today's identity). The host-signal provider follows in the device slice, which supplies the host fingerprints it needs. - Request evidence abstraction (crate::evidence) giving providers read access to the client IP, headers (including cookies), URL path, and query parameters. - Adapter injection seam: RuntimeServices carries an optional vendor provider, so a vendor provider lives in its own crate and core never names it. - Provider-declared identifier semantics: accepts_id gates cookie read-back and withdrawal, normalize_id_for_kv controls the KV key, so an opaque identifier survives byte for byte as both cookie value and storage key. Tests cover the verbatim round-trip with a non-default provider, evidence access at generate time, and opaque KV persistence. Edge Cookie creation and use stay gated by the existing consent context exactly as before, including with no provider selected; the permission model replaces that input in a later slice. The client-set resolve path and the response-header hook are later slices. Config migration: [ec] passphrase is rejected as an unknown field; move it to [ec.providers.hmac] and select provider = "hmac" to keep minting.
jwrosewell
force-pushed
the
split/1-ec-provider
branch
from
August 20, 2026 01:47
312a4fc to
73b40b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of five PRs decomposing #838 into per-feature pieces, as requested in the review discussion, with the design specs in #986 as the review yardstick. Each PR targets main in sequence; #838 closes as superseded when the last piece lands. The five together reproduce #838's head byte for byte, so nothing appears or disappears in the split.
What this PR contains
EdgeCookieProvidertrait: Edge Cookie minting, cookie read-back, and KV keying all route through the selected provider, so a vendor identifier round-trips verbatim instead of being dropped by the built-in shape check (accepts_idgates read-back and withdrawal,normalize_id_for_kvcontrols the KV key).[ec] providerselector with per-provider[ec.providers.<key>]blocks. Thehmacblock carries the passphrase that previously lived on[ec]. With no provider selected, Trusted Server is stateless: nothing mints, and an existing identifier is treated as absent so it is never used or egressed, while the raw cookie value stays available to withdrawal handling.crate::evidence) giving providers read access to the client IP, headers (including cookies), URL path, and query parameters.RuntimeServicescarries an optional vendor provider, so a vendor provider lives in its own crate and core never names it. A selected provider the adapter does not inject fails the request loudly rather than silently running stateless, and a provider block configured without a selector is rejected at startup.Edge Cookie creation and use stay gated by the existing consent context exactly as on main; the permission model replaces that input in the third PR of this series.
Config migration
[ec] passphraseis rejected as an unknown field. Move it to[ec.providers.hmac]and selectprovider = "hmac"to keep minting. Log line changes: the per-request info fieldconsent_allowed=becomesec_allowed=.Verification
cargo fmt --check, all six clippy targets with-D warnings,cargo test-fastly(1,843 core tests),test-axum,test-cloudflare,test-spin, and the cross-adapter parity suite all pass on this branch standalone. Tests include a verbatim round-trip with a non-default provider, evidence access at generate time, and opaque KV persistence.Produced with AI assistance under James Rosewell's direction; needs human review.