Skip to content

Add pluggable native Geo providers and protected CloudFront ingress - #439

Open
ChristianPavilonis wants to merge 28 commits into
feat/native-celld-storesfrom
feature/pluggable-geo-providers
Open

ChristianPavilonis wants to merge 28 commits into
feat/native-celld-storesfrom
feature/pluggable-geo-providers

Conversation

@ChristianPavilonis

@ChristianPavilonis ChristianPavilonis commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Current review readiness

Ready for review. Required current-head CI passed at 414e52ae41ee95880fd11238a22ad2dc944f44c2: test run 42924133045.

Minimal fixes originate in #414 and are merged upward:

  • Typed SDK connector timeouts map to Deadline; non-timeouts remain Unavailable. The previously failing hosted timeout test and all 78 provider cases now pass without assertion, retry or duration changes.
  • Fresh consumers use the existing locked SDK cohort: optional native aws-types =1.6.0 and aws-smithy-runtime-api =1.19.0. This prevents the schema mismatch and preserves the explicit older behavior version instead of switching retry policy or suppressing deprecations. A fresh consumer passes with compiler and Clippy warnings denied throughout.
  • The constructor-boundary test attempts the full upload while independently reading and requiring a complete, finite expected response. The existing startup-readiness poll treats a connection reset as not yet HTTP-ready within its unchanged deadline; success still requires a complete HTTP200 and the original payload checks. Production transport and limits are unchanged.

Local final-top Axum checks pass 488 unit, 28 contract, six AWS startup, four celld startup and 36 hosting cases. Final-top workspace strict Clippy and formatting pass. The prior stable checkpoint passed all six mandatory commands; unchanged inputs retain their receipts, while fresh current-head CI checks the combined state. The current ready state supersedes historical draft-only prerequisites below; unexecuted deployment acceptance is not claimed complete. An additional Fastly WASM runtime job was still running at transition and is not counted as passed. No TS work or deployment qualification is a review prerequisite. Integration #462 remains draft; reviewers aram356, prk-Jr and dhruv8sh remain requested. Stack465 and PR bases are unchanged; #453 is excluded.

Current review-stack checkpoint

Publication head: 414e52ae41ee95880fd11238a22ad2dc944f44c2. This cleanup preserves the existing feature unit and PR identity. The additional change is the completed generated-native build correction: image-only code now follows the scaffold's existing Fastly-example selection, with no request-policy change. Its focused generator/native proof is retained; fresh per-branch hosted checks are not assumed green.

Review order: #275 → #406 → #407 → #409 → #414 → #422 → #439 → #454. Draft integration checkpoint: #462. New SDK/group/codec/phase development and unrelated TS work are not prerequisites or additions to this PR. Earlier notes below retain their original tested revisions and limits; they are not a whole-tree pass for this new head.

Earlier implementation and proof notes

RC refresh checkpoint, 2026-11-10

Current head: c8ee48fcea9828095640a0fa8e593fb59c6d57fa.

Geo-only behavior is ported onto current #409/#422 instead of restoring repeated older dispatch/body code. Built-ins remain synchronous and local. One private outcome is captured from owned ingress and retained through the managed pre-dispatch seam. Native trusted_proxy naming keeps the outbound hard-cut guard byte-unchanged, without the old exemption.

Feature core/native/all-feature, Geo-wire and disabled-feature checks, dependency isolation, strict Clippy, docs/actionlint/format pass. Independent source review found no credible introduced defect. Lower CI/fixture fixes are merged; all five locked fetches and 35 CI tooling cases pass.

Protected CloudFront is a composition: ALB validates the credential value externally; EdgeZero checks the actual socket-source policy and strips the selected credential header, including normalized-head errors, before relevant application callbacks. No live ALB/CloudFront source qualification is claimed. Arbitrary unmanaged ctx.into_request plus a fresh context deliberately resets Geo to NoSelection. This adds no production KV Geo provider or local MaxMind implementation. The admitted-error finalizer is a separate follow-on.

Draft pending fresh hosted checks and the combined RC audit. Two unchanged native default-parallel deadline misses remain recorded and unclassified; serial passes and untouched-foundation parallel passes do not clear them. No timing bound was relaxed. No deployment, main merge, security-alert dismissal or review-thread resolution occurred. Historical design/review context follows.


Summary

  • Add portable validated Geo values, bounded redacted assertions, a synchronous provider contract and one immutable outcome per request.
  • Add default-off native CloudFront and supplied-provider selection, early startup validation and protected-ALB source admission based only on the owned socket peer. No fallback, remote lookup or automatic HTTP permission decision.
  • Add real hosting and portable WASM regressions, deployment guidance, compiled examples and explicit feature/dependency CI coverage.

Stack and prerequisite reconciliation

Base branch: feat/native-celld-stores, draft #422 at 5426ea65. This PR stays on top of the existing native celld stack.

Although the GitHub stack names #409 as an ancestor, this base did not contain its checked-ingress implementation. This diff therefore also reconciles the pinned 66a05e25 checked-ingress/proxy/diagnostics contract. It adapts that commit's own delta while preserving newer native stores, local non-Send initialization, Connections/FuturesUnordered, bounded ingress/config snapshots and asynchronous response EOF validation. The existing forwarding parser supplies the shared bounded peer-network matcher.

The distinct #407 buffered JSON-cap/managed Body feature is not imported or claimed. Native JSON error privacy is retained through private admitted/context state. The plan records exactly which #407-dependent cap/carrier checks are excluded. No old branch tree replaced newer files.

Changes

Crate / File Change
edgezero-core::geo Validated provider IDs, pinned ISO country allowlist, syntax-only subdivisions, bounded input slots and source-free error categories. Portable providers gain no Send/Sync or async requirement.
Core dispatch/context Owned Geo handoff outside public extensions, read-only ctx.geo(), default NoSelection on legacy/unmanaged paths, preserved framework error privacy and egress classification.
Native Geo composition One Off/CloudFront/Supplied selection in AxumRunOptions, capability inspection through finalized options, startup rejection before runner resources, native-only Arc thread bounds.
Checked native ingress Shared CIDR bounds/mapped-peer normalization, separate opaque protected-ALB policy, credential removal before callbacks/error handling while original bytes still count, exactly-once admitted resolution.
Native and portable tests Real no-store listener proof, enabled/disabled/supplied modes, mutation/forgery/cancellation/finalization tests, retained checked-ingress/TLS/lifecycle tests, no-selection WASM contracts.
Docs and CI Native Geo and reconciled diagnostics guides, four compiled Geo examples, explicit feature-state tests, fail-closed dependency graph script, PR trigger for the celld base.
Lockfiles Dependency edges only in root/demo/reusable locks. No selected package version changes. Geo itself adds no third-party runtime dependency.

Issue scope

Closes #432. Implements the CloudFront and synchronous Geo contract under #391. Local GeoIP databases, checked-reader-IP input and database lifecycle are tracked separately in #438 and are not included in this PR.

Trusted Server adoption and jurisdiction/consent interpretation remain separate. Geo is an estimate, not proof of residence, identity or consent. Country-only and unrecognized subdivisions stay unknown to application policy.

Test plan

  • cargo test --locked --workspace --all-targets: 2,115 passed, 6 existing generated-consumer/real-service tests ignored.
  • cargo test --locked -p edgezero-adapter-axum --all-targets --all-features: 422 passed, including mixed AWS/celld startup, preserved lifecycle/EOF tests and 32 hosting tests. Provider service fixtures are loopback-only.
  • Explicit default-off/enabled library suites: 323 disabled and 322 enabled tests passed. Startup-before-resources, bounded parsing, supplied-provider, immutable outcome and exactly-once sentinels executed.
  • Explicit no-default-feature real-hosting suites: 32 enabled and 33 disabled tests passed. Both unavailable-built-in and supplied-without-built-in sentinels passed.
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings, disabled-native Clippy, cargo fmt --all -- --check, git diff --check.
  • Workspace feature compilation, minimal native and bindings-only builds, all three adapter WASM target checks.
  • WASM runtime contracts: Fastly 24 tests using Viceroy 0.21.0, Cloudflare 29 using wasm-bindgen-test-runner 0.2.128 and Node 24.12.0, Spin 35 using Wasmtime 48.0.2. Fastly's preparer/closed-lifecycle sentinel also ran explicitly.
  • New Geo and existing native-store dependency scripts. Geo script also has 16 executed failure-case mock checks.
  • Native doc tests: 5 passed. Warnings-denied workspace rustdoc passed. Guide snippets match the compiled examples.
  • App-demo workspace: 54 passed. Reusable fixture-axum checked against its updated lockfile.
  • Docs lint, format and site build. Seven official AWS source pages checked.
  • Manual edgezero serve --adapter axum. Programmatic production-runner and real-listener tests were used instead; no Geo CLI selector is introduced.
  • Actual CloudFront/ALB deployment and downstream policy acceptance. These require separate authorization and are not substitutes for local CI.

Tested implementation is 56eab85f; the later commit records evidence/status only. Exact commands, tested feature sets, timings, local logs and ignored-test limits are in the implementation plan. No failing local gate is excluded.

Trust and acceptance limits

The protected policy declares an externally credential-gated and isolated ALB path. A matching subnet does not authenticate a distribution or prove that its listener rules are correct. EdgeZero does not receive the configured credential value or call AWS to inspect/provision infrastructure.

Production use still requires deployed proof of the credential gate, target isolation, viewer-header replacement including AWS-network missing-subdivision spoofing, value rotation and shared-cache/error-TTL isolation. The guide requires HTTPS, a default-deny ALB, CloudFront origin-facing prefix-list restrictions, private target access, explicitly generated geographic headers and disabled shared caching. No deployment was attempted.

The six existing ignored generated/service harnesses were not counted as passes. Unchanged docs dependencies report seven npm audit vulnerabilities; no unrelated dependency upgrades were attempted. ShellCheck was unavailable; Bash syntax, behavioral failure cases and real graph checks passed.

Checklist

  • Changes follow CLAUDE.md conventions and scoped ownership.
  • No native runtime or AWS SDK dependency added to portable core/WASM graphs. Reconciled TLS fixture dependencies are native test-only.
  • No legacy route-param syntax or application-side geographic-header trust added.
  • Existing store wiring retains typed registries; Geo is separate from stores and PreparedStores.
  • New behavior has constructor, integration, real-listener and WASM tests.
  • No production secrets committed. Checked-in TLS certificates/key and credential strings are public, disposable fixture material only.

Owned follow-up review checkpoint

  • Branch advanced through an ordinary merge; every previous public head remains an ancestor.
  • Current head: 6365062820d924b314fc52930ccbdbe252fb6b49. Source tree e229fa851df5edc0ec751bb523eab18623191d1e is byte-identical to previous head 3a0e5eb43cdb9e20076b47fcede31d3e1b52f862.
  • Related owned draft: #499. It is intentionally a placeholder until the author cleans feat: implement portable outbound HTTP and request lifecycle contracts #275 and the owned baseline/follow-up are reconciled.
  • Review base and ready/draft state are unchanged. The feature-only review diff is byte-identical to the pre-update diff.
  • Existing qualification remains tied to its recorded inputs. New hosted outcomes are reported separately; this history update does not qualify new source-version-bound binaries or move a release tag.

@ChristianPavilonis
ChristianPavilonis force-pushed the feature/pluggable-geo-providers branch from 72ceed7 to c8ee48f Compare November 10, 2026 20:15
aram356 added a commit that referenced this pull request Nov 16, 2026
Brings #275 at b65e714 and the refreshed heads of #499, #460, #406,
#407, #409, #414, #422 and #439. Each PR merged the one below it, so
this merge has no conflicts. #409 resolved the one conflict on the way
up, in edgezero-core's app.rs imports, by keeping both.
aram356 added a commit that referenced this pull request Nov 16, 2026
Takes #439's refreshed head c1cec8e. The one conflict is the Manifest
struct's schema validators: #502 adds the adapter geo placement check and
#439 brings #275's Fastly logging check. Both are kept, after the existing
case-unique adapter keys check.
aram356 added a commit that referenced this pull request Nov 17, 2026
Brings #275 at ea2549f and the refreshed heads of #499, #460, #406,
#407, #409, #414, #422 and #439, including #422's stock-celld store
service and its merge into #439. Each PR merged the one below it, with
no conflicts on the way up, so this merge has no conflicts.
@ChristianPavilonis
ChristianPavilonis removed this pull request from stack #501 November 17, 2026 17:14
aram356 added a commit that referenced this pull request Nov 17, 2026
#502 reports geo through ctx.geo() on Fastly and Cloudflare and binds Axum geo from the manifest. Its own merge 8cd7af9 resolved its conflict with #439, so this merge is clean.
aram356 added a commit that referenced this pull request Nov 19, 2026
#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.
Bring in PR #275's installation of the wasm32-unknown-unknown target
before the Viceroy 0.22.0 readiness repair builds, which the fastly
wasm tests and Portable record contracts (Fastly) jobs need.
@aram356

aram356 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed c77f6a3b and d08b7646, two merges of #422's new heads. c77f6a3b takes EdgeZero main's Fastly SDK 0.13.3 upgrade (#529), with Viceroy 0.22.0 and the Fastly CLI 17.2.0 upgrade (#531), with #275's exact pins at 0.13.3 and url 2.5.9, its Viceroy readiness repair on 0.22.0, its typed Image Optimizer unavailability check and its drain of declared uploads after an early response on Axum. d08b7646 takes #275's d8cd85c8, which installs the wasm32-unknown-unknown target before the Viceroy 0.22.0 readiness repair builds, as the fastly wasm tests and Portable record contracts (Fastly) jobs need. Both merges had no conflicts.

Bring in PR #275's atomic conditional KV insert in the Viceroy readiness
repair, and the production hosting tests' held port reservations and
spawn-token respawn from PR #406 up, with each later PR's tests reading
the live host's address.
The geo hosting failed-startup checks keep their reservations bound, as
PR #519's 09b09d9 (prk-Jr) does, so a released port cannot be served
by another test's host during the "nothing answers" check.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed ab112554 and 49fb2f48. ab112554 merges #422's new head, which brings #275's atomic conditional KV insert in the Viceroy readiness repair and the production hosting tests' held port reservations and spawn-token respawn from #406 up; it had no conflicts. 49fb2f48 keeps the reservations bound in the geo hosting failed-startup checks, as #519's 09b09d9e does, so a released port cannot be served by another test's host during the "nothing answers" check.

Bring in PR #275's batch cutoff test fix, which advances the test clock
when the request arms its own deadline instead of after dispatch, and
PR #414's AWS emulator proof marker, now published by rename.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed b8187078, a merge of #422's new head that brings #275's 0e2a58ae, which fixes an intermittent failure of the batch cutoff test by advancing its clock when the request arms its deadline timer, and #414's AWS emulator proof readiness marker, now published by rename. It had no conflicts.

Account for the original request head, then hide the origin credential and raw geographic fields before app callbacks when Geo is selected. Keep ordinary forwarding intact and resolve only after admission.

Move the Geo outcome once and rely on the existing body policy for JSON privacy. Cover the startup, forwarding, and dispatch contracts and run the Geo checks only in the workspace CI leg.
@ChristianPavilonis

Copy link
Copy Markdown
Collaborator Author

Review follow-up: 5bf4a674. This is the current-head summary for the older notes in the PR body.

Local checks against the reviewed #422 merge base 57fd4eab: 3,002 workspace tests passed (7 ignored), 675 isolated harness tests passed (4 ignored), and 36 Axum hosting tests passed. Geo hosting passed with the built-in enabled and disabled, including both native JSON privacy sentinels. Strict Clippy, fmt, feature checks, Spin WASM compilation, Geo dependency isolation, workflow lint, and docs lint/format/build passed. These are local results for this patch, not hosted CI or live CloudFront/ALB or Trusted Server acceptance.

@aram356 aram356 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review

Summary

Found while reviewing the rc/identity integration branch (#495) and traced to this PR. Each finding was re-checked at this head (5bf4a674); line numbers refer to it.

Requesting changes for the missing CHANGELOG entry.

Findings

Blocking

  • 🔧 CHANGELOG: ## Unreleased has no entry for pluggable native Geo providers, RequestContext::geo(), or protected CloudFront ingress. All three are new public surface. #454's "KV-backed Geo" entry refers to "the earlier CloudFront-only API", which has no entry of its own.

CI Status

  • GitHub reports no checks at 5bf4a674.

Covers RequestContext::geo(), the edgezero_core::geo types, and opt-in protected CloudFront ingress on Axum.
@aram356

aram356 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

CHANGELOG finding from the review: fixed in dd34d19. ## Unreleased now has a "Native Geo providers" entry covering RequestContext::geo() and its outcome types, edgezero_core::geo and GeoProvider, AxumRunOptions::with_geo with the default-off geo-cloudfront feature, the ProtectedCloudFrontAlb policy, and a migration note on the headers removed once Geo is selected.

@dhruv8sh dhruv8sh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review

Summary

This PR adds a portable, immutable GeoOutcome to RequestContext. It also adds explicit, default-off native Geo selection for managed Axum hosting: a built-in CloudFront parser behind geo-cloudfront and an application-supplied GeoProvider. Both are gated by a separate ProtectedCloudFrontAlb socket-peer policy. The trust boundary is sound:

  • Assertions are captured only for an admitted socket peer.
  • The credential header and both Geo headers are stripped before the preparer, admission and middleware run.
  • The outcome lives in private context storage, so extensions cannot forge it.
  • Selection is validated before any runner resource or listener exists.

I found nothing blocking. The findings below are non-blocking suggestions.

😃 Praise

  • sanitize_received_head strips the credential before it checks the validation result. A rejected oversized head therefore never carries the credential into the error path. The original head still counts toward limits, and the service test covers both behaviours.
  • Moving the network parsing into the shared PeerNetworks lets Geo admission reuse the existing bounds (256 entries, 16 KiB, no whole-family coverage, mapped-IPv4 normalisation) without copying them. Ordinary trusted-proxy policy still cannot admit Geo, and the geo-supplied-untrusted hosting fixture proves that end to end.
  • The forged-extension contract tests on Fastly, Cloudflare and Spin, plus geo_owned_outcome_survives_public_request_mutation, pin down that ctx.geo() cannot be replaced from public state.
  • scripts/check_geo_dependency_contract.sh checks that geo-cloudfront adds no dependencies and that portable crates stay isolated. It fails closed on empty or malformed cargo tree output.

Findings

Blocking

None.

Non-blocking

  • 🤔 Other CloudFront-Viewer-* headers stay untouched: with Geo selected, only CloudFront-Viewer-Country and CloudFront-Viewer-Country-Region are removed. Headers such as -City, -Postal-Code and -Latitude still pass through from any peer (crates/edgezero-adapter-axum/src/geo.rs:316).
  • ♻ Keep NativeHosting: Debug: a redacted manual Debug on NativeGeo would avoid dropping the derive and the .err().expect(..) test churn (crates/edgezero-adapter-axum/src/dev_server.rs:515).

📌 Out of Scope

  • default_dispatch_preserves_serde_json_error_detail in crates/edgezero-core/src/app.rs tests JSON error detail, not Geo. It would fit better in its own change.

return None;
};
let admitted = policy.admit(peer, headers);
let _country = headers.remove(VIEWER_COUNTRY);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤔 Only two of the CloudFront-Viewer-* headers are removed: with Geo selected, take_assertions strips cloudfront-viewer-country and cloudfront-viewer-country-region. Other generated headers still pass through unchanged from any peer, including unadmitted ones: CloudFront-Viewer-City, -Postal-Code, -Latitude, -Longitude, -Time-Zone, -Country-Name, -Country-Region-Name, -Metro-Code, -ASN and -Address.

This matches the documented contract ("both raw Geo fields"). But an operator who turns this on has signalled that this deployment sits behind CloudFront. An app that reads, say, CloudFront-Viewer-City straight from headers will reasonably assume that header gets the same protection, and it doesn't.

Two options:

  • Make it explicit in native-geo.md that only the two v1 fields are stripped, and that the other CloudFront-Viewer-* headers stay spoofable.
  • Or, while Geo is selected, strip every cloudfront-viewer-* name, keeping the two bounded captures as they are. For example:
let _country = headers.remove(VIEWER_COUNTRY);
let _region = headers.remove(VIEWER_REGION);
// Optionally: drop the whole generated family so none of it reaches the app unadmitted.
let generated: Vec<HeaderName> = headers
    .keys()
    .filter(|name| name.as_str().starts_with("cloudfront-viewer-"))
    .cloned()
    .collect();
for name in generated {
    let _removed = headers.remove(name);
}

}

#[derive(Clone, Debug)]
#[derive(Clone)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

♻ Keep NativeHosting: Debug with a redacted NativeGeo impl: the derive was removed because NativeGeo holds Arc<dyn GeoProvider + Send + Sync>. That cascades into the .expect_err(..) → .err().expect(..) rewrites in the existing tests at L2387/L2399.

A small manual impl, matching the redaction style already used for NativeGeoSelection, keeps the derive and the original tests:

impl fmt::Debug for NativeGeo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Off => f.write_str("Off"),
            Self::Selected { policy, id, .. } => f
                .debug_struct("Selected")
                .field("policy", policy)
                .field("id", id)
                .finish_non_exhaustive(),
        }
    }
}

}

#[test]
fn default_dispatch_preserves_serde_json_error_detail() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

📌 Unrelated test: default_dispatch_preserves_serde_json_error_detail checks JSON error-message detail on default dispatch and has nothing to do with Geo. It's a useful regression test, but it would be easier to track in its own PR, or at least with a line in the PR description explaining why it's here.

@prk-Jr prk-Jr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR Review

Summary

Follow-up review at dd34d19d. I checked the code for both of my earlier blocking items, and both are fixed. The protected CloudFront ingress path now behaves as documented: the credential header and the raw Geo fields are gone before any application callback runs; only the owned socket peer can admit input; and an absent or nonmatching peer becomes UntrustedIngress, never a located result. I found no new blocking issues, so I'm approving. The only notes left are optional.

😃 Praise

  • sanitize_received_head puts the order in one place: validate and count the original head, strip the credential even if validation fails, capture input only for a matching peer, remove both raw Geo fields, and only then call the preparer.
  • The new tests catch a regression. I moved strip_credential/take_assertions back after prepare_received_head, and both received_head_preparation_sees_forwarder_auth_but_not_selected_geo_fields and geo_managed_resolution_runs_once_from_owned_ingress failed. I then restored the code.
  • geo-supplied-untrusted covers the forwarding-trust gap I raised earlier: trusted proxy 127.0.0.1, X-Forwarded-For: 192.0.2.1, Geo policy 192.0.2.1/32. The effective client is 192.0.2.1 and the outcome is still untrusted_ingress.
  • Every path that takes AxumRunOptions goes through run_production_selected, which calls options.native_geo()? before any runner resources exist. A selection can't be silently dropped to Off.

Prior findings status (my review at 3a0e5eb4)

  • ✅ Credential header visible to the received-head preparer (blocking ❓): fixed. service.rs:329-335 strips the credential before validation? and calls the preparer last. The router rustdoc (router.rs:391, :762) and the guide (native-geo.md:197-200, :261-263) now say the same thing.
  • ✅ Geo CI steps run in every matrix leg (blocking 🔧): fixed. All nine Geo steps in .github/workflows/test.yml:189-235 have if: matrix.suite == 'workspace'.
  • ✅ No test shows that forwarding trust can't admit Geo (🤔): covered by the geo-supplied-untrusted hosting mode (production_hosting.rs:2487-2513).
  • ✅ Reserved credential names vs. doc comment (⛏): the rustdoc now lists the actual prefixes and names (geo.rs:143-145). Not reserving x-edgezero-* is a reasonable choice.
  • ✅ Nothing pins the detailed JSON error on the Default path (⛏): default_dispatch_preserves_serde_json_error_detail now checks the exact invalid JSON payload: <serde detail> text.
  • ✅ Duplicate dep:ipnet/dep:getrandom (⛏): removed.
  • 📝 #[non_exhaustive] on the public Geo types: deferred to #502 by the author. Fine with me, since it's acknowledged.
  • ⛏ Stale PR description: still open, see below.

For other reviewers' threads: aram356's CHANGELOG request is addressed by dd34d19d, and the entry matches the code.

Findings

Blocking

None.

Non-blocking

  • 🤔 Only the two consumed CloudFront-Viewer-* fields are stripped (docs/guide/native-geo.md:197). See the inline comment.
  • ⛏ PR description is still stale. The "Owned follow-up review checkpoint" names 63650628 as the current head, and "Current review-stack checkpoint" names 414e52ae. The head is dd34d19d, and the description doesn't mention the 5bf4a674 sanitization change. A short "current head and what changed" section would help.

CI Status

These checks ran locally on 5bf4a674 with Rust 1.98.1. The only change since then is the CHANGELOG commit dd34d19d.

  • fmt (cargo fmt --all -- --check): PASS
  • clippy (-p edgezero-core -p edgezero-adapter-axum --all-targets --all-features -D warnings): PASS
  • cargo test -p edgezero-core --all-targets: PASS (1185 lib tests plus doc/integration targets)
  • cargo test -p edgezero-adapter-axum --all-targets --all-features: lib 500 passed; contract, AWS/celld startup and the other targets passed. production_hosting passed 32 and failed 4. The 4 failures are the existing proxy/TLS tests that need 127.0.0.2/127.0.0.3 on loopback, which macOS doesn't have by default. That is the same pre-existing, out-of-scope failure aram356 reported earlier; all geo_hosting_* tests passed.
  • Hosted CI: GitHub reports no checks for this head, so there is no hosted result to cite. The Geo feature-matrix CI steps, WASM runtime contracts and the dependency script were not rerun locally.

Comment on lines +329 to +335
let validation =
validate_normalized_ingress_parts_with_summary(parts, self.app.ingress_head_limits());
self.geo.strip_credential(&mut parts.headers);
let received = validation?;
let assertions = self.geo.take_assertions(peer, &mut parts.headers);
self.app
.prepare_received_head(&parts.headers, &mut parts.extensions);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

😃 This is the ordering I was asking for. The original head is still validated and counted first. The credential is removed before validation?, so even a rejected head never keeps it. Peer-gated capture and raw-field removal both happen before the preparer. I also checked that the tests catch a regression: moving strip_credential/take_assertions after prepare_received_head fails both service tests.

Comment thread docs/guide/native-geo.md
With Geo selected, the managed Axum runner removes every instance of both raw Geo fields before
the received-head preparer, admission callbacks, and middleware, even if the socket peer does
not match the protected policy. The original fields still count toward head limits. With Geo
`Off`, the headers are untouched and carry no trust. Read `ctx.geo()` for checked facts.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤔 Only the two consumed CloudFront-Viewer-* fields are stripped

With Geo selected, take_assertions removes cloudfront-viewer-country and cloudfront-viewer-country-region. Every other CloudFront-generated header stays in ctx.headers() and can be spoofed by a nonmatching peer the same way. That includes CloudFront-Viewer-City, -Postal-Code, -Latitude, -ASN, -Address and CloudFront-Is-*-Viewer. That's consistent with v1's scope; I'm not asking to strip more. But this paragraph tells readers to "Read ctx.geo() for checked facts", and someone could take that to mean the other viewer headers are cleaned up too. Consider one sentence along the lines of: "Other CloudFront-Viewer-* and CloudFront-Is-* headers are not removed or authenticated by EdgeZero; treat them as client-controlled." Non-blocking.

This branch has not been deployed

No deployments
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.

Axum: add protected CloudFront Geo metadata provider

4 participants