Add DataDome server-side protection#769
Merged
Merged
Conversation
988ec06 to
c18ba1b
Compare
aram356
approved these changes
Jun 16, 2026
aram356
left a comment
Collaborator
There was a problem hiding this comment.
Summary
Adds DataDome server-side Protection API validation plus generic integration request-filter infrastructure. The implementation is solid: response effects are applied on every HandlerOutcome path, integration config is validated at load time, fail-open is deliberate and tested, and the new filter infra is cleanly factored and unit-tested. All 14 CI checks pass, and I separately verified the wasm32-wasip1 release build (which CI does not gate) compiles. Approving — every finding below is non-blocking.
Non-blocking
🤔 thinking / 🌱 seedling / 📝 note
- Config/setup errors fail open silently — see inline at
crates/trusted-server-core/src/integrations/datadome/protection.rs:51 - Head-injector attribute-context escaping — see inline at
crates/trusted-server-core/src/integrations/datadome.rs:736 - Server-side key cache has no TTL — see inline at
crates/trusted-server-core/src/integrations/datadome/protection.rs:37 - Challenge response depends on the pointer header — see inline at
crates/trusted-server-core/src/integrations/datadome/protection.rs:406
Cross-cutting / body-level findings
- 🤔 Test coverage gap — Behavioral tests cover the
403challenge and200allow paths well, but not the301/302redirect-challenge path norx-datadome-request-headersupstream enrichment routed through a realclassify_protection_responseresult. Adding both would close the gap and lock in the redirect/Locationbehavior. - 📌 No
wasm32-wasip1build gate in CI — This PR adds wasm-sensitive runtime dependencies (chrono::Utc::now(),std::time::Instant,std::env::var,urlencoding) on the request hot path. I verified thewasm32-wasip1release build compiles locally, but nothing in CI guards it. Worth a follow-up issue to add a wasm build job. (Out of scope for this PR.)
CI Status
- cargo fmt: PASS (required)
- cargo test: PASS (required)
- format-typescript: PASS (required)
- format-docs: PASS (required)
- vitest: PASS
- CodeQL: PASS
- Analyze (rust): PASS
- Analyze (javascript-typescript): PASS
- Analyze (actions): PASS
- integration tests: PASS
- browser integration tests: PASS
- prepare integration artifacts: PASS
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
Changes
crates/trusted-server-core/src/integrations/registry.rscrates/trusted-server-core/src/integrations/datadome.rscrates/trusted-server-core/src/integrations/datadome/protection.rscrates/trusted-server-adapter-fastly/src/main.rscrates/trusted-server-adapter-fastly/src/platform.rs/crates/trusted-server-core/src/platform/types.rscrates/trusted-server-adapter-fastly/src/route_tests.rscrates/trusted-server-core/src/platform/test_support.rs/src/http_util.rscrates/trusted-server-core/Cargo.tomltrusted-server.tomldocs/guide/integrations/datadome.mddocs/superpowers/specs/2026-06-11-datadome-server-side-protection-design.mdCloses
Closes #317
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-wasip1fastly compute servecd docs && npx prettier --check guide/integrations/datadome.md superpowers/specs/2026-06-11-datadome-server-side-protection-design.mdChecklist
unwrap()in production code — useexpect("should ...")println!)