Repository navigation
Conversation
Fastly reads geo_lookup for the client address and Cloudflare reads the request's cf metadata. Both are always selected and pass their outcome through dispatch_admitted_with_geo, so public extensions still cannot replace it. Platform values that fail validation, such as Cloudflare's XX and T1 placeholders, report missing metadata rather than an invalid assertion. GeoSource and GeoTrustBasis gain platform variants and become non_exhaustive; fastly and cloudflare are reserved provider IDs.
[adapters.axum.geo] carries provider, alb_peer_cidrs and origin_credential_header_name defaults, each overridden by the matching EDGEZERO__ADAPTER__GEO__* setting. Precedence is with_geo, then settings, then the manifest, then off, and misconfiguration fails startup instead of falling back. The dev run_app reads settings only. geo_capability() stays explicit-only and geo_capability_for::<A>() reports the runner's view.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
📝 PR review
Reviewed commits 2c41968b and 7ef4766d at head 7ef4766db1e41517082befc81588505e289c0f31. Scope is the three-dot delta against feature/pluggable-geo-providers: pinned base c1cec8e770e350e089e646fe398583d49e685320, merge-base 645703bf39f5965dad5b54d7907e28c9197a7034.
Summary
📝 The adapter integration preserves framework-owned geo independently of public request extensions. One required startup-validation correction is called out inline; the other findings below are non-blocking.
Blocking
🔧 [P2] Preserve raw CIDRs through bounded policy validation — crates/edgezero-adapter-axum/src/geo.rs:290. The settings path accepts inputs rejected by the direct policy constructor. See the inline comment for reproductions and a suggested fix.
Non-blocking
♻️ [P3] Apply reserved provider-ID checks consistently — crates/edgezero-adapter-axum/src/geo.rs:350, together with the new factories in crates/edgezero-core/src/geo.rs:370–375.
The public GeoOutcome::platform() factory makes the reserved fastly and cloudflare IDs obtainable, but NativeGeo::validate rejects only cloudfront for supplied providers. Extracting either new ID from a platform outcome and using it in NativeGeoSelection::Supplied currently succeeds, producing capability metadata such as provider=fastly, source=CloudFront. Consider extending the existing guard and reserved-identity test to all three names. This is diagnostic/API consistency, not a demonstrated authorization bypass.
🤔 [P3] Refresh obsolete platform-coverage statements — docs/guide/native-geo.md:233–234,348.
The guide still says Fastly and Cloudflare expose NoSelection and broadly defers other adapters/sources. Their managed paths now always return a selected platform outcome, including MissingMetadata when no usable geo exists. Update that paragraph and the deferred-work wording, distinguishing these paths from unmanaged conversion/legacy dispatch and Spin.
Praise
😃 Strong end-to-end provenance coverage — crates/edgezero-adapter-axum/tests/production_hosting.rs:2274 checks manifest/settings selection through the actual runner alongside credential removal, immutable outcomes and store-free startup. The Cloudflare contract at crates/edgezero-adapter-cloudflare/tests/contract.rs:418 also verifies that platform metadata wins over raw CloudFront headers.
Verification
📝 Passing checks:
cargo fmt --all -- --check.cargo clippy --workspace --all-targets --all-features -- -D warnings.cargo check --workspace --all-targets --features "fastly cloudflare spin"; Fastly, Cloudflare and Spin target-specific WASM checks.- Full Axum
--all-targets --all-features: 567 passed; full Axum with--features test-utils: 508 passed. - Cloudflare WASM unit/contract/browser suites: 177 passed; guest-shim tests passed.
- Fastly WASM: 366 passed on an unfiltered rerun, using Viceroy 0.21.0 with the repository's CI readiness patch. Its ten readiness regressions and timeout-readback regression passed.
- Example workspace: 66 passed; example Fastly/Cloudflare WASM builds passed.
- Geo dependency-isolation contract passed. An additional local Viceroy probe passed 18 actual HTTP requests covering located/missing/partial/invalid metadata and spoofed geo headers.
cargo test --workspace --all-targets --exclude edgezero-adapter-axum: 2,406 passed.
📝 Failures retained rather than hidden: the initial cargo test --workspace --all-targets runs failed the tight timing allowance in connection::tests::pending_chunked_forward_preserves_original_deadlines_over_tcp. The same failure reproduced in isolated builds of both the merge-base and pinned named base, before the geo commits; the later full Axum suites passed without filtering. Initial stock and patched Viceroy runs also aborted at the unchanged outbound cutoff assertion in outbound.rs:3497; the later unfiltered Fastly rerun passed. The genuine merge-base Fastly library suite passed all 327 tests. These observations are not additional defects attributed to this PR's delta. Hosted CI passed for the reviewed head.
📝 Acceptance boundary: first-party documentation and local runtimes support the field mappings, but live Cloudflare/Fastly delivery and CloudFront/ALB credential gates, isolation, caching and rotation remain unverified. No candidate-specific deployed target was supplied; local emulation is not production deployment qualification.
| match provider { | ||
| Some(ManifestGeoProvider::CloudFront) => { | ||
| let networks: Vec<&str> = match env_networks { | ||
| Some(raw) => raw.split(',').map(str::trim).collect(), |
There was a problem hiding this comment.
🔧 [P2] Preserve raw CIDRs until the existing bounded policy validator
map(str::trim) removes disallowed control characters and bytes that should count toward the 16,384-byte input budget before PeerNetworks validates them. With geo-cloudfront enabled, I reproduced both:
"127.0.0.1/32\n"format!("127.0.0.1/32{}", " ".repeat(16_384))
Both return InvalidProtectedPolicy through ProtectedCloudFrontAlb::new, but the same values supplied through EDGEZERO__ADAPTER__GEO__ALB_PEER_CIDRS resolve to an active CloudFront capability. The eager collect() also materializes the whole list before the existing 256-entry bound is checked.
Please pass the untrimmed split iterator directly to the policy constructor, and handle the manifest iterator similarly, so the existing validator owns normalization, byte accounting and entry limits. For example, after resolving header:
let policy = match env_networks {
Some(raw) => ProtectedCloudFrontAlb::new(raw.split(','), header),
None => ProtectedCloudFrontAlb::new(
manifest
.and_then(|geo| geo.alb_peer_cidrs.as_deref())
.unwrap_or_default(),
header,
),
}?;Please add settings-path regression tests for control characters and oversized raw input, alongside the existing direct-constructor boundary tests.
#517 (10ed380) tops ChristianPavilonis's line on #439: - #510, the KvStore record contract with DynamoDB and celld providers on Axum (#472, #473); - #454, portable KV-backed geo; - #514, country and region through ctx.geo() on Cloudflare and Spin (#480, #486); - #517, the portable ClientInfo contract with its Fastly, Axum, Cloudflare and Spin mappings (#475, #90, #91, #92, #485). #517 also merged #469 and #502 itself, so its tree contains everything this branch had. The only conflicts were JA4 lines that #517 refactors on top of #469; this merge takes #517's version, and its tree is identical to #517's.
Bring in main's Fastly SDK 0.13.3 upgrade (#529) with Viceroy 0.22.0 and the Fastly CLI 17.2.0 upgrade (#531), with PR #275's exact pins at 0.13.3 and url 2.5.9, its Viceroy readiness repair on 0.22.0 and its typed Image Optimizer unavailability check for SDK 0.13.3. The merge also brings in the 27 PR #439 commits this branch did not yet contain. It merges without conflicts.
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
|
For the identity integration branch (#495), I pushed |
prk-Jr
left a comment
There was a problem hiding this comment.
Summary
The platform geo wiring looks right. Fastly does a geo_lookup of the downstream client address before the prepare hook runs. Cloudflare reads cf.country / cf.regionCode. Both feed dispatch_admitted_with_geo. The Axum manifest/settings precedence is clear and well tested. I checked the Fastly SDK 0.13.3 source: Geo::region() is documented as the subdivision part only, so passing it straight to SubdivisionCode is correct. Placeholder countries such as XX and T1 fail CountryCode validation and correctly become MissingMetadata.
I'm requesting changes because the blocking settings-path finding from the earlier review is still present at 690a8d88. Every commit since that review is a merge of the base, and none of them touch crates/edgezero-adapter-axum/src/geo.rs.
Blocking
Settings-supplied ALB CIDRs bypass the protected-policy validator (crates/edgezero-adapter-axum/src/geo.rs:290, inline). I reproduced this at this head with geo-cloudfront enabled:
ProtectedCloudFrontAlb::new(["127.0.0.1/32\n"], "x-origin-verify")returnsErr(InvalidProtectedPolicy).EDGEZERO__ADAPTER__GEO__PROVIDER=cloudfront, withALB_PEER_CIDRS="127.0.0.1/32\n"and the same header, resolves toOk(Selected { provider: cloudfront, source: CloudFront, trust_basis: DeclaredProtectedAlb }).
This is the operator path that admits a trusted geo source. Input that the policy constructor deliberately rejects (control characters, raw bytes over the 16,384-byte budget, and the list being collected before the 256-entry bound is checked) must not be accepted just because it came through an env var. The fix suggested in the existing thread still applies. Pass the untrimmed raw.split(','), or the manifest slice, directly to ProtectedCloudFrontAlb::new so the validator owns trimming, byte accounting and entry limits. Add settings-path regression tests for a control character and for oversized raw input.
Non-blocking (still open from the earlier review)
docs/guide/native-geo.md:233still says Fastly and Cloudflare exposeNoSelection. Managed requests on those adapters now always carry a selected platform outcome.NativeGeo::validatestill rejects only thecloudfrontID for supplied providers.fastlyandcloudflareare now reserved too, and they can be obtained fromGeoOutcome::platform().
Verification
cargo +1.98.1 test -p edgezero-adapter-axum --features geo-cloudfront --lib geo: 11 passed.cargo +1.98.1 test -p edgezero-core --lib -- geo manifest: 104 passed.- Throwaway probe test showing the direct-constructor vs settings mismatch above. It was not committed.
- Hosted CI at
690a8d88: fmt, clippy (native and all three WASM targets), workspace, Axum, CLI and app-demo tests, Fastly/Cloudflare/Spin WASM tests and CodeQL all pass. Release and smoke jobs were still queued or running when this review was submitted. - Not verified: live Fastly/Cloudflare geo delivery, and the Fastly WASM tests run locally.
| match provider { | ||
| Some(ManifestGeoProvider::CloudFront) => { | ||
| let networks: Vec<&str> = match env_networks { | ||
| Some(raw) => raw.split(',').map(str::trim).collect(), |
There was a problem hiding this comment.
Blocking, still reproducible at 690a8d88. map(str::trim) normalizes the settings value before ProtectedCloudFrontAlb::new sees it, and collect() materializes the whole list before the 256-entry bound applies. I reproduced this with geo-cloudfront enabled. ALB_PEER_CIDRS="127.0.0.1/32\n" resolves to an active DeclaredProtectedAlb CloudFront capability, while the same value passed to the constructor directly returns InvalidProtectedPolicy.
Pass raw.split(',') (untrimmed), or the manifest slice, straight to ProtectedCloudFrontAlb::new so the existing validator owns normalization, byte accounting and entry limits. Add settings-path tests for a control character and for raw input over 16,384 bytes.
PR #524 (outbound mTLS client identities, #523) belongs to no identity epic, and PR #522 (portable DynamoDB and celld record providers on Fastly, #474) is still a draft. #524 is stacked on #522, so both leave together. This commit reverts their net changes. Its tree is rc/identity as it was before #522 (654f546) merged with the current tips of #519, #515, #502, #469 and #536, the branch's remaining lines. #514 and #517 are already inside them. The rebuild merges without conflicts, and the change touches only the 113 paths that #522 and #524 changed against #517. Three files differed from a plain reverse of the two PRs because of the conflict resolutions in 7616c85 and b3a45df. Each keeps the other lines' code and drops only #522's or #524's: - crates/edgezero-adapter-axum/src/cli.rs keeps the capability matrix test's lint expectation and drops #524's client identity test. - crates/edgezero-adapter-fastly/src/request.rs keeps the after-response handle and wrapper and drops #522's deferred portable KV registry. - crates/edgezero-store-aws/src/dynamodb_records_tests.rs drops imports used only by #522's tests. Merging a later tip of #522 or #524 will not restore this code, because git treats their earlier commits as already merged. Bringing them back needs a revert of this commit first.
Summary
ctx.geo()now reports country and region on Fastly (geo_lookupfor the client address) and Cloudflare (the request'scfmetadata), always on, so applications such as Trusted Server no longer need platform-specific geo code (EZI-4, EZI-4c).[adapters.axum.geo]inedgezero.toml, with every key overridable byEDGEZERO__ADAPTER__GEO__*at startup. This replaces Trusted Server'sTS_NATIVE_GEO_PROFILEboot profile (EZI-4a); deploy-time values such as ALB networks stay out of the compiled manifest.feature/pluggable-geo-providers) becausemainhas no geo code yet. Spin (EZI-4s) follows separately.Changes
edgezero-core/src/geo.rsGeoSource::{Fastly, Cloudflare},GeoTrustBasis::PlatformMetadata, both enums#[non_exhaustive]; reservedfastly/cloudflareprovider IDs;GeoOutcome::platform()treats unusable platform values (e.g. CloudflareXX/T1) as missing metadata, not a forged assertionedgezero-core/src/manifest.rs[adapters.axum.geo]table (provider,alb_peer_cidrs,origin_credential_header_name); rejectsprovider = "off"with policy fields and the table on non-Axum adaptersedgezero-adapter-fastly/src/request.rsdispatch_admitted_with_geoedgezero-adapter-cloudflare/src/request.rscf.country/cf.regionCodeand dispatches withdispatch_admitted_with_geoedgezero-adapter-axum/src/geo.rs,run_options.rs,dev_server.rswith_geo→ settings → manifest → off; misconfiguration fails before listening; devrun_appreads settings only;geo_capability()stays explicit-only, newgeo_capability_for::<A>()reports the runner's selection; shared geo setting-name listcfmetadata, Axum precedence/rejection units, end-to-end manifest + settings hosting test, dev-runner test, baked-manifest round trip; #439 contract tests updated for always-on platform geodocs/guide/native-geo.md,configuration.md,adapters/axum.mdCloses
Part of #482 (Fastly, Cloudflare and Axum). Spin (EZI-4s) remains, so this does not close the issue.
Test plan
cargo test --workspace --all-targets(2921 passed)cargo clippy --workspace --all-targets --all-features -- -D warnings(pinned 1.98.1)cargo fmt --all -- --checkcargo check --workspace --all-targets --features "fastly cloudflare spin"wasm32-wasip1(Fastly) /wasm32-wasip2(Spin) /wasm32-unknown-unknown(Cloudflare)examples/app-demoworkspace:cd examples/app-demo && cargo test --workspace --all-targetsedgezero serve --adapter axumproduction_hostinggeo tests with and withoutgeo-cloudfront; Axum doc testsLocal Viceroy 0.21.1 aborts some Fastly outbound backend tests (e.g.
configured_connect_timeout_reads_registered_sdk_timeout_settings) on unmodified #439 as well; CI's patched Viceroy is the reference.Checklist
{id}syntax (not:id)edgezero_core(nothttpcrate)KvRegistry/ConfigRegistry/SecretRegistry(not the legacy single-handle setters) — see spec §6.6