Repository navigation
Conversation
dhruv8sh
left a comment
There was a problem hiding this comment.
PR Review
Summary
This adds a bounded, static-allowlist sanitizer (config_diagnostics::ValidationReport) for typed app-config validation failures. Approved path+code pairs keep fixed operator explanations through EdgeError::ConfigValidation; everything else is redacted, including every validator field name, both at runtime and in CLI validate/push/diff. The sanitizer is well bounded and thoroughly tested. However, the blanket field-name redaction removes useful diagnostics from the operator's own CLI.
😃 Praise
- 😃 A tight, well-bounded sanitizer (
crates/edgezero-core/src/config_diagnostics.rs:200). The walker spends its budget before allocating or sorting attacker-sized maps and sorts keys so output is deterministic. Matches must be exact path+code, with wildcards for list indices only. Tests cover every limit at N and N+1 and plant canaries in messages, params, map keys, and nested names. Apps that don't opt in keepConfigOutOfDate. - 😃 Shared adapter contract fixture.
contract_fixture::extraction_error()runs the real store read, validation, and error mapping through all four adapters' response conversion in one place.
Findings
Blocking
- 🔧 CLI validate/push/diff no longer says which field or rule failed (
crates/edgezero-cli/src/config.rs:265,:473,:650).- Symptom:
FixtureConfigwith[service] timeout_ms = 50now printstyped app-config failed validation: app config failed validation for field `<redacted>.<redacted>`. Before this PR it namedservice.timeout_msand the range rule. This affects every app that hasn't registered a diagnostic for every rule.typed_errors_on_validator_rule_failureonly checks for the word "validation", so CI doesn't catch it. - Why it can be narrower: the threat (a runtime-derived map key used as a field name) can be targeted precisely. Every public
ValidationErrorsbuilder (add,merge,merge_self,merge_all) takes&'static strand storesCow::Borrowed. Onlyerrors_mut().insert(Cow::Owned(..))yields a runtime key, and derived map validation uses numeric indices. - Fix: keep the
CowinActualSegmentand redact only owned keys. Then assert thatservice.timeout_msappears intyped_errors_on_validator_rule_failure;runtime_validation_redacts_untrusted_map_keysstill covers the hostile case.enum ActualSegment<'tree> { Field(&'tree Cow<'static, str>), Index(usize) } // render_path fallback: ActualSegment::Field(Cow::Borrowed(name)) if is_safe_ident(name) => name, ActualSegment::Field(_) => "<redacted>",
- Symptom:
Non-blocking
- 🤔 The public
field_pathis always the literal"<redacted>"(crates/edgezero-core/src/config_diagnostics.rs:228; emitted aterror.rs:114and:318), even for approved diagnostics, so it tells a client almost nothing. The fix above restores static names. Otherwise, omit the key when every segment is redacted. - 🤔 The operator message redacts a field and then names it (
crates/edgezero-core/src/config_diagnostics.rs:140). It reads…for field `<redacted>`; implementation [implementation_unavailable]: …. When diagnostics are present, skip the genericfor field …prefix. - 🤔 Existing
ConfigOutOfDatematches silently miss approved failures (crates/edgezero-core/src/error.rs:32). Downstreammatches!(e, EdgeError::ConfigOutOfDate { .. })checks returnfalseonce an app registers any diagnostic. Consider a publicis_config_out_of_date()covering both variants, and mention it in the migration guide. - ⛏
--no-default-featureshas no effect (.github/workflows/test.yml:115) becauseedgezero-corehas no default features. Also,runtime_approved_diagnostic_tracks_compiled_availabilityusescfg!(feature = "test-utils"). Feature unification means the refusal branch only runs in this separate step, so a comment on the test explaining that would help. - ⛏ Duplicate diagnostics (
crates/edgezero-core/src/config_diagnostics.rs:239). The same approved code on the same field is pushed twice, using 2 of the 8MAX_DIAGNOSTICSslots. Skip the push when the previous(field_path, code)matches. - 🌱
#[app_config(diagnostics = …)]on a nested-only child is silently ignored (crates/edgezero-macros/src/app_config.rs:664). A future lint could flag it.
📌 Out of Scope
- 📌 Rust 1.99 clippy failure: with no
rust-toolchain.toml, clippy 1.99 fails on existing code atcrates/edgezero-macros/src/app_config.rs:478(rest_pattern_accessible_field). Worth tracking before the next toolchain bump.
CI Status
Run locally on the pinned Rust 1.98.1:
- fmt: PASS
- clippy: PASS
- tests: PASS
- check
--features "fastly cloudflare spin": PASS - spin
wasm32-wasip2check: PASS
ChristianPavilonis
left a comment
There was a problem hiding this comment.
😃 Approved — no blocking correctness or security defects found.
The shared, bounded approval registry preserves fixed operator diagnostics without retaining validator messages or parameters. The extraction-backed adapter contracts provide strong coverage of the operator/public boundary.
Review observations
- The loss of unregistered field names in typed CLI validate/push/diff is real, but is an intentional, documented default-redaction trade-off rather than an accidental implementation error. I do not consider it blocking for this opt-in contract.
- I independently checked the earlier borrowed-key suggestion:
Cow::Borrowedproves lifetime, not schema provenance. A runtime-derived key held inOnceLock<String>can reachValidationErrors::addas borrowed. The current sanitizer correctly redacts it; the borrowed-key shortcut would weaken that protection. Preserving more CLI field locations would require a trusted schema-metadata approach. - A focused probe exercised real typed CLI entry points and the
#[action]extraction →RequestLogger→ Axum service →SimpleLoggerpath. Approved explanations reached operator output; validator message/value canaries did not. HTTP stayed coarse: 503,config_out_of_date, andRetry-After: 60.
Verification
Passed locally with Rust 1.98.1:
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-targets— 1,565 passed, 1 ignoredcargo check --workspace --all-targets --features "fastly cloudflare spin"cargo check -p edgezero-adapter-spin --target wasm32-wasip2 --features spin- Separate core compiled-implementation refusal and feature-enabled success controls
- Fastly and Cloudflare WASM contract compilation
- Spin WASM contract execution — 13 passed
- Cloudflare browser/WASM contract execution — 14 passed
- Workflow actionlint with explicit installed tool paths
- Focused standalone CLI, borrowed-runtime-key, and native Axum logging/public-response probes
Local Fastly runtime execution was not repeated because installed Viceroy is 0.17.0 rather than the pinned 0.21.0. I inspected the actual Fastly CI log: Viceroy 0.21.0 ran the new contract successfully, with 8 contract tests and 97 runtime unit tests passing. Docs/demo startup checks were not repeated locally; GitHub checks are green.
Reviewed all 17 changed files at head eba3ce157259a49b15d0b7c5d737871cbc084284 against base/merge-base e11ea3082f66ec864aabdd6007b15c4926c73b82. No production source changes were made during review.
|
Addressed the follow-up findings in c5b2f3b2.
Local verification on Rust 1.98.1 passed: all five repository gates, including 1,568 workspace tests (one ignored), plus both feature controls. Docs ESLint/Prettier passed on Node 24.20.0; actionlint passed. GitHub confirms the commit is Verified. CI for this new commit is pending; provider WASM runtime contracts were not rerun locally. The borrowed-name proposal remains a documented disagreement for reviewer consideration. |
dhruv8sh
left a comment
There was a problem hiding this comment.
PR Review
Summary
This PR adds a bounded sanitizer in config_diagnostics. It turns typed app-config ValidationErrors into a safe report, and only explanations registered in a static per-type list are passed through. Approved failures get a new opt-in EdgeError::ConfigValidation variant. The sanitizer is used by the runtime extractor, the typed CLI validate/push/diff commands and RequestLogger. Public 503 responses stay coarse. I found no blocking issues. The remaining points are about the developer experience of the new redaction default.
😃 Praise
- The walker is carefully bounded: entries, depth, visited nodes, diagnostics, code and explanation lengths, and path bytes all have limits. It checks the container size before it allocates or sorts keys. It never retains validator messages or params, and the canary tests (
UNTRUSTED_*,RESOLVED_SECRET_CANARY, map-key canaries, the borrowed-'statickey case) show this directly. - Adding a separate
ConfigValidationvariant, rather than adding fields toConfigOutOfDate, keeps existing constructors source-compatible.EdgeErroris already#[non_exhaustive], andconfig_validation()falls back toConfigOutOfDatewhen no diagnostic is approved, so apps that don't opt in see no variant change.is_config_out_of_date()gives callers a clean migration path. - Contract tests on all four adapters (Axum, Fastly, Cloudflare, Spin) use a shared fixture to check that approved explanations never reach the response body.
- The extra CI step that runs
runtime_approved_diagnostic_tracks_compiled_availabilitywithouttest-utilscloses a real gap: workspace feature unification would otherwise only ever run the success branch.
Findings
Non-blocking
- 🤔 Public
field_pathnow carries a placeholder string: unapproved failures emit"field_path": "<redacted>"/"<redacted>[2].<redacted>"in the HTTP JSON. Consider omitting the key, as the missing-blob path already does (crates/edgezero-core/src/config_diagnostics.rs:232) - 🤔 CLI validation errors lose field names by default: without a registry,
config validate/push/diffnow print only<redacted>paths, even for plain schema rules likerange(crates/edgezero-cli/src/config.rs:265)
📌 Out of Scope
- The older spec
docs/superpowers/specs/2026-06-16-blob-app-config.md(§6.3.1 / §12.6) still saysfield_pathnames the offending field. A follow-up note pointing to the new design doc would stop future readers relying on the old contract.
Summary
Integration note: a current
git merge-treecomparison with #509, #512, #514 and #515 reports conflicts in Axum response conversion, Cloudflare/Spin contracts, and core error/extractor code. These siblings need reconciliation when integrated.Changes
edgezero-core/config_diagnosticsedgezero-core/app_configandedgezero-macros#[app_config(diagnostics = REGISTRY)]root registrationedgezero-core/extractor,error, andmiddlewareConfigValidationerror and operator accessor; keep HTTP 503,config_out_of_date, andRetry-After: 60edgezero-cli/config.github/workflows/test.ymltest-utilsUnknown validator field names are now redacted, including names that could be attacker-controlled map keys. Applications opting in should account for
ConfigValidationor usevalidation_diagnostics()/operator_message(); existingConfigOutOfDateconstructors remain supported. Extraction adds no store read, complete-policy reparse, or second validation pass.Closes
Closes #457
Test plan
Historical author-reported local verification below (original head unrecorded unless an explicit SHA is given). These results, counts, timings and negative controls were not rerun in this audit, and their underlying local logs were unavailable; checked boxes retain the original report. Previously reported green checks belong to earlier revisions and do not verify later commits.
Local checks used Rust 1.98.1 and Node.js 24.20.0.
cargo test --workspace --all-targets— 1,565 passedcargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcargo check --workspace --all-targets --features "fastly cloudflare spin"fastly clicombination and Spin's relocated contract testtest-utils, and the same policy's feature-enabled success controlactionlint .github/workflows/test.ymlexamples/app-demoworkspace tests — left to CInpm run lint,npm run format, andnpm run buildedgezero serve --adapter axumChecklist
edgezero_coreReview follow-up
5bb2e253omits public validator field paths (including placeholder nesting/indices) and adds a CLI-only hint for registering matching approved diagnostics. Approved operator explanations and independent explicit/deserialization configuration errors retain their contracts. All five required local Rust gates, standalone compiled-refusal control, and docs lint/format passed on Rust 1.98.1 and Node 24.20.0. One initial logging-capture test failure passed in serial and normal full-suite reruns; logging code is unchanged. Hosted CI for5bb2e253subsequently passed all 28 non-CodeQL checks; CodeQL flagged test assertion messages that formatted returned diagnostics.Test-only follow-up
cfaec86areplaces those assertion failure messages with fixed descriptions in the two affected CLI tests. All assertion conditions, matrix inputs, approved explanations, privacy canaries and no-provider-state checks remain unchanged; production behavior is unchanged. Both affected tests and all five required local gates passed on Rust 1.98.1, including 1,569 workspace tests (1 ignored), all-features Clippy, feature compilation and Spinwasm32-wasip2compilation. The first sandboxed workspace attempt could not bind loopback sockets; the full rerun with socket access passed. All 29 hosted checks now pass oncfaec86a. The processed Rust CodeQL analysis is error/warning-free with zero findings across 27 rules; the cited alert(s) are fixed.