Honor publisher Host override and bypass IO for SVG assets#787
Conversation
|
Follow-up after testing the deployed branch: the first patch deployed as |
aram356
left a comment
There was a problem hiding this comment.
Summary
Correct, well-tested, and CI-green. The publisher Host-override is implemented through the right mechanism — origin_host_header_override → PlatformBackendSpec.host_header_override → BackendConfig::ensure() → Backend::override_host(...), which the Fastly SDK documents as forcing the outbound Host. The SVG Image Optimizer bypass is a genuine correctness fix with a focused regression test. No blocking issues; two non-blocking suggestions (inline) to make intent explicit and add the unit-testable half of the override coverage.
Non-blocking
♻️ refactor
- Document the Host
set_headernormalization — it's defensive only; the wire Host is forced by the backend'soverride_host, and it applies to every backend, not just the publisher origin. (crates/trusted-server-adapter-fastly/src/platform.rs:312— suggestion inline) - Add request-side override coverage — assert a configured
origin_host_header_overridereaches the outbound request's Host header viaStubHttpClient. (crates/trusted-server-core/src/publisher.rs— suggested test inline)
👍 praise
- SVG bypass checks both incoming and rewritten paths with a targeted regression test. (
crates/trusted-server-core/src/proxy.rs) - Backend name encodes the override (
_oh_suffix) so different overrides don't collide or get poisoned by first-registration-wins, and the value is validated against control characters. (crates/trusted-server-core/src/backend.rs)
⛏ nitpick
- History includes "Load Prebid split bundle synchronously" and its immediate revert (net-zero in the diff) — consider squashing on merge.
CI Status
- fmt: PASS
- clippy: PASS
- rust tests: PASS
- js tests: PASS
- integration / browser tests: PASS
Co-authored-by: Aram Grigoryan <132480+aram356@users.noreply.github.com>
Summary
override_hostwhenpublisher.origin_host_header_overrideis configured..svg/.svgz.Changes
crates/trusted-server-core/src/platform/types.rshost_header_overridetoPlatformBackendSpec.crates/trusted-server-core/src/publisher.rspublisher.origin_host_header_overridewhen registering the publisher origin backend.crates/trusted-server-adapter-fastly/src/platform.rsPlatformBackendSpec::host_header_overrideintoBackendConfig::host_header_override; adds override-aware backend name test.crates/trusted-server-core/src/integrations/mod.rscrates/trusted-server-core/src/integrations/datadome/protection.rscrates/trusted-server-core/src/proxy.rscrates/trusted-server-core/src/platform/test_support.rsCloses
Closes #786
Closes #789
Test plan
cargo test --workspacecargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest runcd crates/js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1Checklist
unwrap()in production code — useexpect("should ...")println!)