Repository navigation
Conversation
#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.
The workspace now pins url =2.5.9 for main's Fastly SDK 0.13.3 upgrade (#529), and this loader resolves edgezero-core from the workspace, so its lockfile no longer satisfied the manifests after the merge. A targeted `cargo update -p url --precise 2.5.9` moves url to 2.5.9 and form_urlencoded to 1.2.3, matching the v0.0.12 lockfiles.
|
For the identity integration branch (#495), I pushed
|
|
For the identity integration branch (#495), I pushed |
dhruv8sh
left a comment
There was a problem hiding this comment.
PR Review
Summary
This PR does four things: it finishes Cloudflare managed geo coverage across all three entrypoints, adds an opt-in Spin KV geo provider gated on a pinned dataset and an authenticated visitor-IP header, adds a separate operator loader (Rust component plus Python runner), and allows the runner's unit tests through the CI tool policy. The trust model and deadline handling are careful and well tested. I found no blocking issues. The findings below are small hardening and documentation-accuracy points.
😃 Praise
- In
dispatch_ingress_stream_with_timer_and, head limits are checked against the original header bytes before the privatex-edgezero-geo-*headers are captured and stripped. Admission callbacks therefore never see the credential, and the private headers still count toward the limits. Tests cover both properties (private_geo_headers_count_toward_original_head_limits,configured_geo_does_not_read_secrets_before_admission). SpinKvGeo::resolvetakes one absolute KV deadline, capped by the admitted read deadline, and doesn't reset it between stages. TheAdvancingKvtest (four reads of 80 ms against a 250 ms budget) and the pending-read drop test show this precisely.from_configrejects unknownEDGEZERO__ADAPTER__GEO__*keys through the new value-freeEnvConfig::keys_below, so a typo fails loudly and nothing leaks into diagnostics.- The Cloudflare contract matrix runs the same metadata and spoofed-header cases through
CloudflareService,run_appanddispatch_app.
Findings
Blocking
None.
Non-blocking
- 🤔 Token comparison short-circuits on length:
subtle's slicect_eqreturns early when lengths differ, which leaks the secret's length (crates/edgezero-adapter-spin/src/geo.rs:280). - 🤔 The runner may send its token to a local process that grabbed the port first: the port is reserved and then released before
spin upbinds it, and the readiness probe accepts any listener (examples/geo-spin-loader/load.py:36). - 🤔 The stripping claim in the docs is broader than the code: the public unmanaged
into_core_requestconverter does not remove the private geo headers (docs/guide/adapters/spin.md:425). - 🌱 Geo is resolved eagerly on every authenticated request: every admitted request with a token pays for one secret read and about four KV reads, whether or not the route uses
ctx.geo()(crates/edgezero-adapter-spin/src/request.rs:444). - ⛏
urllib.erroris used but never imported: it only works becauseurllib.requesthappens to import it (examples/geo-spin-loader/load.py:148).
📌 Out of Scope
- The new
run.shexception narrowly admits one exactpython3 -m unittestcommand intest.yml, and tests show variants are still rejected. Maintainers may still want to confirm they accept a Python runtime in the CI tool policy.
CI Status
- Not run: this review was static.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Reviewed this PR's delta against feature/kv-geoip at 7580806a, excluding the inherited #502 work. Please address R1 and R2 before shipping the operator loader: its timeout does not own the real Spin process tree, and TCP readiness does not establish that the authenticated POST reaches its own listener. The other inline findings are follow-ups.
The focused native geo tests, Spin and Cloudflare guest contracts, loader and publisher tests, and all ten new deploy-action assertions passed. The deploy-action suite's remaining Fastly failure also reproduced on the base. The Spin guest and fake-runtime tests do not qualify real loader cleanup or a deployed proxy.
aram356
left a comment
There was a problem hiding this comment.
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 (c12fd631); line numbers refer to it.
Requesting changes for two blocking findings.
Findings
Blocking
- 🔧 Spin geo misconfiguration answers every request with 422. See
spin/src/geo.rs:37. - 🔧 CHANGELOG:
## Unreleasedhas no entry for the completed Cloudflare geo or the pinned Spin KV geo lookup.
Non-blocking
- 🤔 An early timer wake ends the Spin geo lookup. See
spin/src/geo.rs. - 🤔 An unusable country code gets a different status per provider. Platform geo (
core/src/geo.rs:399-400, outside this diff) givesUnavailable(MissingMetadata)for a well-formed code outside the snapshot, such asXK. KV geo givesUnavailable(UnsupportedGeography), and Axum CloudFront rejects the whole result asInvalidAssertion(that part is already open on #439). A portable handler that serves a "region unsupported" page onUnsupportedGeographymisses those visitors on Fastly and Cloudflare. UseUnsupportedGeographyhere too, or document the matrix innative-geo.md.
CI Status
- GitHub checks at
c12fd631: 29 of 29 pass.
A bad geo selection is a deployment error. As a validation error, assembly answered every visitor with 422 and the message; as an internal error it is a redacted 500.
The credential read and KV lookup treated any timer completion as the deadline. Like the Spin config and secret reads, re-check the deadline and keep polling the same in-flight work.
|
CHANGELOG finding from the review: fixed in b576456. |
Bring in PR #454's KV Geo review fixes and the review fixes below it, from PR #510 down to PR #275, including PR #439's Geo sanitization, which strips the CloudFront viewer fields for every selected Geo, RunMode hosting, the KvOpenFailure categories and main's lockfile versions. CHANGELOG.md: both sides added Unreleased sections at the top. The resolution keeps the base's sections first, then this PR's "Spin KV Geo and Cloudflare platform Geo". docs/guide/native-geo.md: the resolution keeps PR #439's paragraph on what cannot admit protected CloudFront assertions. It then uses this PR's NoSelection paragraph (unconfigured Spin, Fastly and Cloudflare platform geography) in place of the base's older Spin wording.
|
Round 12 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
|
Review-summary follow-ups in 0434ec0c: the existing Unreleased entry for Spin KV / Cloudflare geo is retained, with its header-stripping statement scoped to managed dispatch. The native geo guide now records the provider distinction for unsupported countries such as XK: platform geo reports MissingMetadata, KV reports UnsupportedGeography, and Axum CloudFront reports InvalidAssertion. The existing internal-500 and early-wake corrections were reverified, including a real Spin component-environment misconfiguration returning a redacted 500. No hosted checks were observed for that original correction head. CI follow-up in b9829802: refreshed the six active |
|
Round 15 identity realignment:
Each merge message says what it carries and how any conflict was resolved. |
The setting now drops the manifest's geo fields, as on Axum, instead of rejecting them and answering every request with a 500.
Credential, binding, timeout and store failures were indistinguishable ProviderFailure outcomes; a fixed-reason warning names them without request values.
Review follow-up: fixes committed to this branchA full review of this PR turned up the problems below; each would otherwise have needed a follow-up ticket, so it is fixed on this branch instead. Every item names its commit.
Fixes made on the PRs below this one in the stack were merged into this branch with merge commits. 5ba992f adapts the merged #510 Spin record-requirement test to this branch's dispatch signature ( |
Summary
ctx.geo()metadata coverage and add opt-in Spin lookup against an explicitly pinned KV dataset, authenticated visitor-IP assertion, and one aggregate deadline.Stacked on #454 (
feature/kv-geoip), which includes #502. The parent supplies the portable KV reader and Axum foundation. #517 splits Spin authentication and lookup; integration must carry the per-read deadline guard, single secret deadline owner, early-wake handling and private test seam through that split. No dependent branch is changed here.Changes
edgezero-adapter-spinedgezero-coreexamples/geo-kv-prototypeexamples/geo-spin-loaderSpin defaults to off. KV selection requires a declared store, generation/hash pin, authenticated-header reader mode and a Spin credential-variable name. A trusted proxy must replace and authenticate the original visitor IP. Both roots and the selected path are verified per request. Invalid deployment configuration produces a redacted 500; ordinary geography outcomes do not themselves select HTTP status or grant permission. No automatic fallback or lazy-resolution feature is added.
Closes
Closes #480
Closes #486
This PR targets
feature/kv-geoip, so merging it there does not automatically close the issues on the default branch.Current CI follow-up
Current revision:
b9829802b4e43db1a0eb02ecf4f43b0c9fbbe481, using Rust 1.98.1, Node 24.20.0, Spin 4.1.0 / SDK 8 and Wasmtime 48.0.2.pin-project-lite0.2.17 was yanked, so newly generated offline consumers could no longer resolve it from the locked cache. Six active lockfiles now select non-yanked 0.2.19; no other package nodes changed. Generated consumers still resolve their own dependencies without network access or seeded fixture locks.Three fake-Cargo cancellation tests performed real source/compiler fingerprinting twice before their five-second readiness check. Their dedicated test helper now supplies a scoped fixture identity and fake compiler. Nested-unwind restoration is covered; production identity capture and every readiness, cancellation, listener and reaping assertion remain unchanged. This does not repair the separate macOS zombie-group signal race.
All 30 hosted checks now pass on b982980, including the current native and Wasm suites. The processed Rust CodeQL analysis has no errors, warnings or findings across 27 rules; the other configured language analyses are also clean. The local synthetic/runtime limitations below remain applicable; earlier verification and controls are recorded separately.
Historical verification for the original review correction
Historical correction:
0434ec0c23cd0760501e1d3eeda6136e9bdcc2d0, using Rust 1.98.1, Node 24.20.0, Spin 4.1.0 / SDK 8 and Wasmtime 48.0.2.Mandatory workspace format, strict all-feature Clippy, workspace tests (3,095 passed; seven ignored), all-target feature compilation and Spin Wasm compilation.
Isolated harness: 679 passed; four ignored. Spin Wasm strict lint and all 39 contracts / 25 SDK tests passed.
Publisher default/all-feature tests (14 each), strict lint and formatting; loader Rust/Python tests (one / 12), strict lint, formatting and final release Wasm build.
All 32 native adapter feature combinations; isolated CLI-only graph does not enable core
geo-kv.Docs lint, formatting and VitePress build.
The broader
scripts/run_tests.shinvocation completed tooling/workspace/harness/dependency/native-feature checks and Axum executor-ownership/native/fixture checks, then was interrupted during optional Axum wire qualification. Its owned process groups were stopped and checked. This is not a complete prescribed-suite pass; remaining runtime qualification is separate. Stock Viceroy 0.22.0 does not include the repository's tracked local-runtime repairs.Actual Spin loader: fresh three-object publication, identical replay, paused real HTTP-trigger publication timeout, readiness timeout, unauthorized 401 and corrupt-artifact 500; launcher/trigger exit, listener closure and temporary root/staging removal checked.
Actual Spin async managed serving consumer: declared KV metadata, real credential-variable provider, populated SQLite and component environment produced
Located(US, CA)with KV/authenticated-header provenance. Admission and handler saw neither private header. Wrong credential and dataset gap failed the fixture's expected-location assertion.Meaningful isolated controls rejected launcher-only cleanup, redirect forwarding, unchecked report identity and timer-first-only deadline handling. Ready reads advancing 100ms under a 250ms aggregate budget stop at three reads; late pending resume, admitted deadline cap, preexpired zero reads, early wake and pending cancellation are covered.
Synchronous guest tests explicitly inject their timer. SDK timer cancellation is separately exercised through Spin's actual async HTTP export; a synchronous CLI test export cannot certify that host contract.
No GitHub Actions runs were observed for the original correction head
0434ec0c23cd0760501e1d3eeda6136e9bdcc2d0. The new CI follow-up triggered Actions naturally; all 30 checks have now succeeded. Earlier green checks and historical runtime counts are not current-head qualification.Local synthetic evidence does not qualify deployed proxy protection, live external-backend credentials/permissions/propagation, licensed-data accuracy or production capacity. Guest deadline cancellation does not certify host/backend cancellation. Request-local lookup repeats secret/manifest/root reads. Publication requires one operator per generation; read-before-write is not a distributed lock, and failed publication may leave validated resumable partial objects.
Checklist
CLAUDE.mdconventions{id}syntaxedgezero_coreKvRegistry