Skip to content

Drop Bing header rewrites from DNR and webRequest - #1112

Open
PeterDaveHello wants to merge 1 commit into
ChatGPTBox-dev:masterfrom
PeterDaveHello:chore/drop-bing-dnr-rule
Open

PeterDaveHello wants to merge 1 commit into
ChatGPTBox-dev:masterfrom
PeterDaveHello:chore/drop-bing-dnr-rule

Conversation

@PeterDaveHello

@PeterDaveHello PeterDaveHello commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Retire the request-header overrides used by the legacy Bing Web provider for www.bing.com and sydney.bing.com.

This removes DNR rule 1 from src/rules.json and the matching webRequest.onBeforeSendHeaders listener from src/background/index.mjs. Chromium MV3 relied on the DNR rule, while Firefox MV2 also applied the blocking listener. Removing both keeps the header behavior consistent across browsers.

This PR isolates the header rewrite cleanup from the provider removal planned in a follow-up PR. Bing search-page extraction retains its host permissions, site adapter, and search result selector.

Validation

  • npm run pretty:check
  • npm run lint
  • npm test
  • npm run build
  • Required Chromium build artifacts verified
  • Manual browser smoke testing remains pending

View guided diff

Summary by CodeRabbit

  • Changes
    • Bing HTTP and WebSocket requests are no longer modified to replace their Origin and Referer headers with Bing URLs. These requests retain their original header values instead. Header-handling behavior for ChatGPT and Claude remains unchanged, so this update affects only the handling of Bing requests and does not alter those other services.

The legacy Bing Web provider used both mechanisms to rewrite Origin
and Referer headers for www.bing.com and sydney.bing.com.

Dropping only the DNR rule would leave Firefox's blocking webRequest
listener rewriting those headers. Retire both paths together for
consistent behavior across browsers.
Copilot AI balanced review requested due to automatic review settings October 7, 2026 14:59

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89443349-0966-4c12-aff2-34e8910954d2
📥 Commits

Reviewing files that changed from the base of the PR and between c4951b7 and b06ea0d.

📒 Files selected for processing (2)
  • src/background/index.mjs
  • src/rules.json
💤 Files with no reviewable changes (2)
  • src/rules.json
  • src/background/index.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Bing-specific Origin and Referer rewrites were removed from the background listener and declarative rules. The separate Claude header listener and the ChatGPT and Claude header rules remain.

Changes

Bing request header rewrites

Layer / File(s) Summary
Remove Bing header rewrites
src/background/index.mjs, src/rules.json
The background listener and declarative rule that rewrote Origin and Referer for Bing HTTP and WebSocket requests were removed.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to b06ea

No actionable breakage is established, so the change is mergeable after normal checks. Manual browser testing remains pending.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of Bing header rewrites from both DNR and webRequest.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Remove Bing header rewrites across Chromium and Firefox

⚙️ Configuration changes ✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Remove Bing Origin and Referer overrides from Chromium’s DNR rules and Firefox’s webRequest
 listener.
• Keep Bing search-page extraction and unrelated header rules intact.
Diagram

graph TD
  Req["Network requests"] --> MV3["Chromium MV3"] --> Bing["Bing endpoints"]
  Req --> MV2["Firefox MV2"] --> Bing
  MV3 -->|other hosts| DNR["Remaining DNR rules"]
  MV2 -->|other hosts| WR["Remaining webRequest listeners"]
Loading
High-Level Assessment

Removing both browser-specific overrides together is the appropriate scope. Removing only the DNR rule would leave Firefox rewriting Bing headers; removing the provider or Bing permissions now would also affect search-page functionality reserved for a separate change.

Files changed (2) +0 / -65

Enhancement (1) +0 / -43
index.mjsRemove Bing webRequest header listener +0/-43

Remove Bing webRequest header listener

• Deletes the listener that rewrote Origin and Referer on Bing HTTPS and WebSocket requests, including its Firefox MV2 blocking registration. Other request listeners remain.

src/background/index.mjs

Other (1) +0 / -22
rules.jsonRemove Bing DNR header rule +0/-22

Remove Bing DNR header rule

• Deletes rule 1, which set Origin and Referer for Bing requests in Chromium MV3. The ChatGPT and Claude rules remain unchanged.

src/rules.json

@qodo-code-review

qodo-code-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Bing Web chats fail after header removal ✗ Dismissed
Description
The Bing Web request path still calls BingAIClient, but removing both Bing header interception
paths stops its conversation and WebSocket requests from receiving the Bing Origin and Referer
headers. Selecting either Bing Web model therefore sends requests with the extension or
browser-origin headers instead of the values previously applied to www.bing.com and
sydney.bing.com, causing Bing authentication or request validation to fail.
Code

src/background/index.mjs[L918-922]

-    {
-      urls: ['wss://sydney.bing.com/*', 'https://www.bing.com/*'],
-      types: ['xmlhttprequest', 'websocket'],
-    },
-    ['requestHeaders', ...(Browser.runtime.getManifest().manifest_version < 3 ? ['blocking'] : [])],
Evidence
The background dispatcher still selects generateAnswersWithBingWebApi for Bing Web models. That
API constructs BingAIClient, whose conversation request is sent to www.bing.com and whose
WebSocket connects to sydney.bing.com; the removed listener and rule were the only repository code
that rewrote those requests' Origin and Referer headers.

src/background/index.mjs[559-568]
src/services/apis/bing-web.mjs[22-43]
src/services/clients/bing/index.mjs[90-153]
src/services/clients/bing/index.mjs[166-180]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

Issue description
The Bing Web provider remains selectable and is still invoked by the background request dispatcher, but this change removes the only DNR and webRequest mechanisms that rewrite its Bing request headers. Bing Web conversation creation and WebSocket requests consequently lose the expected Bing Origin and Referer values before the provider is removed.

Fix Focus Areas
- src/background/index.mjs[882-925]
- src/rules.json[1-46]
- src/services/clients/bing/index.mjs[90-190]

Recommended Fix
Either defer both Bing rewrite removals until the Bing Web provider and its model options are removed, or remove/disable the Bing Web provider in the same change. If the provider must remain available, restore equivalent Origin and Referer rewriting for its `www.bing.com` and `sydney.bing.com` requests in both browser paths.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 6 rules
Review mode: Auto: 🚀 Fast: Localized removal of redundant Bing header rewrites across two files.

Grey Divider

Tip of the day
💡 Did you know, you can route each severity your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/background/index.mjs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The still-selectable Bing Web provider depends on the removed rewrites and will break before its planned removal.

1 open finding
What changed in this PR

Removes legacy Bing request-header rewriting across Chromium and Firefox.

Changes:

  • Removes Bing DNR header rule.
  • Removes matching background webRequest listener.
File Description
src/​rules.json Removes Chromium Bing header rewrites.
src/​background/​index.mjs Removes Firefox Bing header listener.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/rules.json
@@ -1,26 +1,4 @@
[

@PeterDaveHello PeterDaveHello Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to correct my earlier conclusion.

The Sydney WebSocket still has a caller, and the client cannot replace the browser-level Origin rewrite through the WebSocket constructor. Removing that rewrite before removing the provider is a valid sequencing concern.

The anonymous GET checks returned 404 HTML with and without the legacy headers, but that result cannot distinguish an unavailable endpoint from missing authentication. It does not justify keeping the original merge order or requiring an authenticated before/after reproduction before changing it.

Issue #805 reports that the Bing integration stopped working after the Copilot/Bing website redesign. That provides context for retiring the provider, but does not establish that every authenticated request path is unusable.

The safer merge order is to remove the Bing Web provider first, then merge this header cleanup. The PRs can remain separate; #1112 should wait until the provider removal has landed.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — deletion-only cleanup that retires the legacy Bing request-header overrides from both browser paths.

  • src/rules.json — removes DNR rule id: 1, the Bing origin/referer rewrite for www.bing.com/sydney.bing.com. The chatgpt.com (id: 2) and claude.ai (id: 3) rules are unchanged.
  • src/background/index.mjs — removes the Bing webRequest.onBeforeSendHeaders listener and its MV2 blocking flag; the Claude listener that follows it is untouched.

The Bing Web provider itself is still wired up, so on first read removing its header rewriting looks like a possible regression — the client's own Referer header is a forbidden header that fetch silently drops, leaving the deleted interceptor as the only mechanism that ever set Origin/Referer. It checks out as safe here because the endpoints that provider calls are retired (https://www.bing.com/turing/conversation/create?... returns 404, and Bing Chat was folded into Copilot), so the provider is already non-functional regardless of these headers. Repo-wide grep confirms this pair was the only place rewriting Bing Origin/Referer, and no test, doc, or rule-id reference depends on the removed rule.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 3/5

  • Removing the header rewrites in src/rules.json may break Bing Web for users who select bingFree4 or bingFreeSydney, since those providers remain active. Keep the rewrites or update the provider configuration.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/rules.json">

<violation number="1" location="src/rules.json:20">
P2: This removes the header rewrites for `sydney.bing.com`/`www.bing.com` while the Bing Web provider they supported is still active and user-selectable. `bingFree4`/`bingFreeSydney` remain selectable in `src/config/index.mjs` and still dispatch through `generateAnswersWithBingWebApi` at `src/background/index.mjs:559-567`. The Bing client's own `Referer` in its fetch init (`src/services/clients/bing/index.mjs:127`) is a forbidden request header and is silently dropped by browser `fetch()`, so the DNR rule (MV3) and the blocking listener (MV2) were the only mechanism putting the Bing origin/referer on the `/turing/conversation/create` XHR and the `wss://sydney.bing.com/sydney/ChatHub` handshake. With both removed, those requests now go out with `Origin: chrome-extension://<id>` and no Bing referer, which risks 403/rejection for the still-active Bing Web provider. The identical rewrite pattern is retained for chatgpt.com and claude.ai (rules 2/3 and the Claude listener), confirming it is still needed and only Bing's was dropped. Consider landing the Bing provider removal in the same PR, or keeping the rewrites until the follow-up lands, or explicitly documenting the interim breakage in the PR description.</violation>
</file>

Click Fix with cubic on a comment, or reply @cubic-dev-ai fix this, and cubic writes the fix.

View guided diff | Re-trigger cubic

Comment thread src/rules.json
]
},
"condition": {
"requestDomains": ["sydney.bing.com", "www.bing.com"],

@cubic-dev-ai cubic-dev-ai Bot Oct 7, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This removes the header rewrites for sydney.bing.com/www.bing.com while the Bing Web provider they supported is still active and user-selectable. bingFree4/bingFreeSydney remain selectable in src/config/index.mjs and still dispatch through generateAnswersWithBingWebApi at src/background/index.mjs:559-567. The Bing client's own Referer in its fetch init (src/services/clients/bing/index.mjs:127) is a forbidden request header and is silently dropped by browser fetch(), so the DNR rule (MV3) and the blocking listener (MV2) were the only mechanism putting the Bing origin/referer on the /turing/conversation/create XHR and the wss://sydney.bing.com/sydney/ChatHub handshake. With both removed, those requests now go out with Origin: chrome-extension://<id> and no Bing referer, which risks 403/rejection for the still-active Bing Web provider. The identical rewrite pattern is retained for chatgpt.com and claude.ai (rules 2/3 and the Claude listener), confirming it is still needed and only Bing's was dropped. Consider landing the Bing provider removal in the same PR, or keeping the rewrites until the follow-up lands, or explicitly documenting the interim breakage in the PR description.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/rules.json, line 20:

<comment>This removes the header rewrites for `sydney.bing.com`/`www.bing.com` while the Bing Web provider they supported is still active and user-selectable. `bingFree4`/`bingFreeSydney` remain selectable in `src/config/index.mjs` and still dispatch through `generateAnswersWithBingWebApi` at `src/background/index.mjs:559-567`. The Bing client's own `Referer` in its fetch init (`src/services/clients/bing/index.mjs:127`) is a forbidden request header and is silently dropped by browser `fetch()`, so the DNR rule (MV3) and the blocking listener (MV2) were the only mechanism putting the Bing origin/referer on the `/turing/conversation/create` XHR and the `wss://sydney.bing.com/sydney/ChatHub` handshake. With both removed, those requests now go out with `Origin: chrome-extension://<id>` and no Bing referer, which risks 403/rejection for the still-active Bing Web provider. The identical rewrite pattern is retained for chatgpt.com and claude.ai (rules 2/3 and the Claude listener), confirming it is still needed and only Bing's was dropped. Consider landing the Bing provider removal in the same PR, or keeping the rewrites until the follow-up lands, or explicitly documenting the interim breakage in the PR description.</comment>

<file context>
@@ -1,26 +1,4 @@
 [
-  {
-    "id": 1,
-    "action": {
-      "type": "modifyHeaders",
-      "requestHeaders": [
-        {
-          "operation": "set",
-          "header": "origin",
</file context>
Fix with cubic

@PeterDaveHello PeterDaveHello Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to correct my earlier conclusion.

The selectable Bing models and dispatch path still use this client. Its fetch-init Referer does not replace the browser-level rewrites, so removing those rewrites before the provider is a valid sequencing concern.

The anonymous GET checks returned 404 HTML with and without the legacy headers, but that result cannot distinguish an unavailable endpoint from missing authentication. It does not justify keeping the original merge order or requiring an authenticated before/after reproduction before changing it.

Issue #805 reports that the Bing integration stopped working after the Copilot/Bing website redesign. That provides context for retiring the provider, but does not establish that every authenticated request path is unusable.

The safer merge order is to remove the Bing Web provider first, then merge this header cleanup. The PRs can remain separate; #1112 should wait until the provider removal has landed.

@PeterDaveHello

Copy link
Copy Markdown
Member Author

@coderabbitai what do you think?

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh pr diff 1112 --repo ChatGPTBox-dev/chatGPTBox
ast-grep outline src/background/index.mjs --items all
rg -n -C4 'onBeforeSendHeaders|sydney\.bing\.com|www\.bing\.com|rule_resources|declarativeNetRequest|removeRuleIds|addRules' src -g '!**/locales/**'
cat -n src/rules.json
gh pr view 1112 --repo ChatGPTBox-dev/chatGPTBox --json title,body,statusCheckRollup

Length of output: 28029


@PeterDaveHello, I think this is a well-scoped cleanup. I found no blocking issue in the diff.

  • Removing both the DNR rule and the webRequest.onBeforeSendHeaders listener avoids leaving the Bing header rewrite active in Firefox.
  • ChatGPT and Claude DNR rules remain unchanged. There is no need to renumber their IDs.
  • The diff does not remove Bing search-page extraction code or permissions.
  • Format, lint, tests, and Safari build checks passed.

The remaining risk is the legacy Bing provider. It still connects to sydney.bing.com, so removing the header rewrites can affect its requests before the follow-up removes the provider. This does not invalidate the cleanup, but it is not behavior-neutral for that provider.

Before merging, I recommend a Chromium and Firefox smoke test. Confirm that Bing search-page extraction still works and that the extension no longer applies the Bing header rewrites. I have not verified browser behavior.

You are interacting with an AI system.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants