Repository navigation
Conversation
Replace to_abs with normalize_creative_url and move exclusion policy to Rewrite::should_proxy_asset and Rewrite::should_wrap_click, sharing the case-insensitive proxy host matcher. Normalize exclude_domains at load. This is the shared step for #1231 and #1234. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…when unset Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
The rewrite pass registers asset handlers only when rewrite_creatives is on and the anchor handler only when click rewriting resolves on. Base removal and TSJS injection run whenever either is on. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…rty proxy Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
…avior Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Add the [rewrite] include_domains field with load-time normalization, strict entry validation and blob round-trip tests. Enforcement arrives in the next commit, which applies the list to asset rewriting and first-party sign. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Apply the include list to every asset handler and to first-party sign. Click-through links and fetch-time proxy checks are unchanged. Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
Signed-off-by: dhruv8sh <dhruv8sh@proton.me>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[rewrite] include_domains, a host allowlist for creative asset rewriting./first-party/proxy, and each proxied fetch appends the EC ID, so every third-party asset host receives it.exclude_domainsstill wins over the list, and click-through links are never affected./first-party/signapplies the same policy for absolute and//input.502, the same as an excluded host, so the creative runtime loads the raw URL directly.403: still means only "blocked byproxy.allowed_domains".ts config push. That includes schemes, ports, paths, stray dots, unbracketed IPv6, and non-ASCII names, which must be written in punycode.<link imagesrcset>was proxied twice, wrapping the proxy URL inside another proxy URL.Implements the approved design in #1248:
docs/superpowers/specs/2026-10-07-1231-creative-asset-host-allowlist-design.md.Stacked on #1252. This branch builds on the #1234 implementation, which introduces the shared normalizer and host-policy split.
48d59b8d,ef8ad67f,9d9fb273and2dfe7e7b.d8f04390…ee5715f1) are cherry-picks of Make creative click rewriting a separate switch #1252 with identical patch IDs, and are reviewed there.spec/1231-creative-asset-host-allowlist(**Spec**: creative asset host allowlist #1248).mainand only the four Add a host allowlist for creative asset rewriting #1231 commits remain.Changes
These are the #1231 commits only.
crates/trusted-server-core/src/settings.rsinclude_domainsfield (left out of the blob when empty), load-time normalization, strictvalidate_include_domains, and the include clause inshould_proxy_assetviais_host_permitted; testscrates/trusted-server-core/src/creative.rslink[href]no longer rewritesimagesrcset; the[imagesrcset]handler rewrites it once. Tests and module docscrates/trusted-server-core/src/proxy.rsis_host_permittedmadepub(crate); sign decline log; an 8-case GET/POST sign matrix covering200,502and403crates/trusted-server-core/src/config_payload.rsdocs/guide/configuration.md,creative-processing.md,first-party-proxy.md,api-reference.md502. Fixes the*.cdn.example.comapex exampletrusted-server.example.tomlinclude_domainsexampleCHANGELOG.mdinclude_domains; Fixed the inlineimagesrcsetdouble proxyCloses
Closes #1231
Test plan
cargo test-fastly && cargo test-axum. Alsocargo test-fastly-reuse,cargo test-cloudflare,cargo test-spin,./scripts/test-cli.shand the parity tests.cargo clippy-fastly && cargo clippy-axum. All 8 clippy aliases pass, and every intermediate commit passesclippy-fastly.cargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest run(no JS changes)cd crates/trusted-server-js/lib && npm run format(no JS changes)cd docs && npm run format, plus the markdown prettier check outsidedocs/cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveimagesrcsetregression test was seen failing on the unfixed code. Make creative click rewriting a separate switch #1252's switch-matrix tests pass together with this branch's allowlist tests.Rollout: deploy the binary first, then add
include_domainsand runts config push. Rollback: removeinclude_domainsand push first, then roll back the binary; older binaries reject the key because ofdeny_unknown_fields.Hardening note:
include_domainsentry fails settings validation with a config error rather than a panic. Covered byrewrite_include_domains_reject_malformed_entries.exclude_domainsentries: empty and bare"*"entries are dropped with a warning instead of rejected, so existing configs keep loading after an upgrade.Checklist
unwrap()in production code — useexpect("should ...")tracingmacros (notprintln!)