fix(executors): DuckDuckGo AI Chat uses duckduckgo.com (fixes 400) (#4037) - #4333
Merged
Merged
Conversation
The DuckDuckGo AI Chat executor fetched status/chat and set Origin/Referer against https://duck.ai while sending Sec-Fetch-Site: same-origin, making the same-origin triplet (host + Origin + Referer) inconsistent so the backend rejected the request with HTTP 400. Repoint the executor's status URL, chat URL, Origin, Referer, and warm fetch to https://duckduckgo.com (matching the provider registry baseUrl and current DDG reverse-engineering references); the same-origin header is now coherent. Also relax FE_VERSION_PATTERN from a 40-hex tail to a bounded {20,40} tail so it matches the real served x-fe-version token (20-hex, e.g. serp_20250401_100419_ET-19d438eb199b2bf7c300) instead of silently falling back to the hardcoded default. The bound keeps the pattern ReDoS-safe. This is the DuckDuckGo half of the report; the separate Chipotle upstream breakage is tracked independently. TDD: tests/unit/duckduckgo-domain-4037.test.ts (8 assertions, RED before the fix, GREEN after). Baseline bump 917->925 for the added comments. Refs #4037
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tkgo11
pushed a commit
to tkgo11/OmniRoute
that referenced
this pull request
Sep 23, 2026
…iegosouzapw#4037) (diegosouzapw#4333) The DuckDuckGo AI Chat executor fetched status/chat and set Origin/Referer against https://duck.ai while sending Sec-Fetch-Site: same-origin, making the same-origin triplet (host + Origin + Referer) inconsistent so the backend rejected the request with HTTP 400. Repoint the executor's status URL, chat URL, Origin, Referer, and warm fetch to https://duckduckgo.com (matching the provider registry baseUrl and current DDG reverse-engineering references); the same-origin header is now coherent. Also relax FE_VERSION_PATTERN from a 40-hex tail to a bounded {20,40} tail so it matches the real served x-fe-version token (20-hex, e.g. serp_20250401_100419_ET-19d438eb199b2bf7c300) instead of silently falling back to the hardcoded default. The bound keeps the pattern ReDoS-safe. This is the DuckDuckGo half of the report; the separate Chipotle upstream breakage is tracked independently. TDD: tests/unit/duckduckgo-domain-4037.test.ts (8 assertions, RED before the fix, GREEN after). Baseline bump 917->925 for the added comments. Refs diegosouzapw#4037
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.
Refs #4037 (the DuckDuckGo half — Chipotle is tracked separately, see below)
Problem
DuckDuckGo AI Chat returns HTTP 400. The executor hardcoded
DUCKAI_BASE = "https://duck.ai"for the status/chat fetches,Origin, andReferer, while sendingSec-Fetch-Site: same-origin— an inconsistent same-origin triplet (the live backend is served fromduckduckgo.com), which the backend rejects with 400. Secondary:FE_VERSION_PATTERNrequired a 40-hex tail but the real servedx-fe-versiontoken has a 20-hex tail, so the scrape never matched and silently fell back to a hardcoded future-dated default.Fix
STATUS_URL,CHAT_URL,AUTH_TOKEN_URL,COUNTRY_URL,Origin,Referer, and the homepage warm-fetch onto the already-presentDUCKDUCKGO_BASE = "https://duckduckgo.com"(consistent same-origin triplet;Sec-Fetch-Site: same-originkept).FE_VERSION_PATTERNtail[0-9a-f]{40}→[0-9a-f]{20,40}(bounded, ReDoS-safe) to match the real 20-hex token.exportonSTATUS_URL/CHAT_URL/FAKE_HEADERS/FE_VERSION_PATTERNfor testability. Out-of-scopeduck.airefs (challenge-stub fingerprint, comment, opt-in Playwright path) intentionally untouched.Validation (Hard Rule #18)
tests/unit/duckduckgo-domain-4037.test.ts(8 assertions): all HTTP-path URLs +Origin/Refereruseduckduckgo.com;FE_VERSION_PATTERNmatches a real 20-hex token and still a 40-hex one. RED 1/8 → GREEN 8/8; existingduckduckgo-web-executor+ web-cookie sweep green (23/23 on my re-run). Lint 0-err,typecheck:coreclean, file-size baseline bumped 917 → 925.