Skip to content

fix: pass credentials from --proxy-server as proxy username/password - #264

Merged
JustasMonkev merged 3 commits into
mainfrom
claude/tender-ramanujan-32qj01
Oct 5, 2026
Merged

JustasMonkev merged 3 commits into
mainfrom
claude/tender-ramanujan-32qj01

Conversation

@JustasMonkev

@JustasMonkev JustasMonkev commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Upstream change

  • microsoft/playwright#43071 / commit 7ad3fba: fix(mcp): pass credentials from --proxy-server as proxy username/password, which fixes microsoft/playwright#43048. Upstream added proxySettingsFromString(). It splits http://user:pass@host:port into { server, username, password }, and the MCP config and --proxy-server help text now use it.

Why it matters here

src/config.ts passed the --proxy-server / PLAYWRIGHT_MCP_PROXY_SERVER string to launchOptions.proxy.server unchanged. Browsers ignore credentials embedded in the proxy server URL. Users behind an authenticating proxy therefore got 407 Proxy Authentication Required on every navigation and scan, even though the flag accepted the credentials without error.

Change

  • src/config.ts: added a local proxySettingsFromString() that mirrors upstream. It defaults a missing scheme to http, percent-decodes the username and password, and falls back to { server } when the URL has no credentials or does not parse. --proxy-bypass is still applied on top. Proxies set in the config file are unchanged, because they already take explicit username/password fields. The client-certificate path copies the launch proxy into the context, so it now carries the credentials too.
  • src/program.ts, SKILL.md: the help text and docs now give the credentialed form as an example.
  • tests/config.test.ts: added cases for a credentialed URL with a percent-encoded password, a schemeless URL, socks5 with only a username, URLs without credentials (unchanged), and the env var path.

Validation

  • npm run lint (oxlint + typecheck) and npm run knip are clean.
  • vitest run tests/config.test.ts passes (111 tests).
  • In the cloud container, the full suite has failures that also occur without this change. They happen because Chromium build 1243 isn't installed there (Executable doesn't exist at /opt/pw-browsers/chromium_headless_shell-1243/...). None of them are in config tests.

Other upstream MCP changes reviewed this run (no action taken)

🤖 Generated with Claude Code

https://claude.ai/code/session_018WmuRF1oEPjUCA7RC1YPci


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Proxy URLs containing credentials now pass the username and password separately to the proxy settings. Encoded credentials are decoded, and URLs without a scheme are handled as HTTP.
  • Documentation
    • Clarified that credentials in a proxy URL are used as the proxy username and password.

RetriggerConfidence Score: 4/5

The PR should not merge until proxy passwords containing a literal percent sign work and the required README documentation is added.

Findings

  1. P1 Literal percent breaks proxy authentication ▶
  2. P2 README omits new proxy behavior ▶
Fix with agent prompt
### Issue 1
src/config.ts:591
For a proxy password containing a literal `%`, such as `http://user:pa%ss@proxy.test:3128`, `new URL()` accepts the value but `decodeURIComponent()` throws. The catch then passes the original URL as `server` without separate credentials, so authentication still fails for this proxy.

### Issue 2
src/program.ts:152
This adds credentialed proxy URLs to CLI help, but the README does not explain the new configuration or its environment-variable equivalent. AGENTS.md requires a README update when user-facing configuration changes, so that requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR extracts proxy credentials from CLI and environment proxy URLs into Playwright’s explicit proxy fields and updates help text and configuration tests.

  • A literal % in a password still defeats credential extraction.
  • The required README update is missing.

Reviews (1) · Last reviewed commit: "fix: pass credentials from --proxy-serve..."

Port of upstream microsoft/playwright#43071 (7ad3fba). A proxy URL such as
"http://user:pass@myproxy:3128" passed via --proxy-server or
PLAYWRIGHT_MCP_PROXY_SERVER is now split into server/username/password, so
browsers answer 407 Proxy Authentication challenges instead of ignoring the
embedded credentials.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WmuRF1oEPjUCA7RC1YPci
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T04:07:26.948969Z 7020736 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7dc2b3de-f493-405e-97b6-54332ffb80b4
📥 Commits

Reviewing files that changed from the base of the PR and between 327039c and 7020736.

📒 Files selected for processing (3)
  • README.md
  • src/config.ts
  • tests/config.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a0498022-a795-4c1a-a177-708567ad2a4a
📥 Commits

Reviewing files that changed from the base of the PR and between 3e2765d and 327039c.

📒 Files selected for processing (4)
  • SKILL.md
  • src/config.ts
  • src/program.ts
  • tests/config.test.ts

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


📝 Walkthrough

Walkthrough

Proxy server values from CLI and environment options now separate URL credentials into proxy username and password fields. Option descriptions now explain credential handling and show an authenticated proxy URL.

Changes

Proxy credential parsing

Layer / File(s) Summary
Parse proxy credentials
src/config.ts, tests/config.test.ts, SKILL.md, src/program.ts
Proxy settings separate decoded URL credentials from the server value. Tests cover CLI and environment values, credential formats, and bypass preservation. The option descriptions explain credential handling.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 32703

No actionable issue remains from the supplied evidence. The proxy credential change is mergeable after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to 32703

The change affects 3 systems.

Changed systems: src, SKILL.md, tests

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 2 changed files map to changed impact.
  • observed — SKILL.md (service) was modified; 1 changed file maps to changed impact.
  • observed — tests (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in SKILL.md: The --proxy-server description now specifies that credentials in the URL are sent as proxy username/password; the previous description only gave a proxy URL example.
  • observed — Modified behavior in src/config.ts: The proxy server option now uses proxySettingsFromString instead of assigning the input directly as the proxy server.
  • observed — Modified behavior in src/config.ts: Adds proxySettingsFromString: it parses proxy URLs, assuming http when no scheme is supplied. If credentials are present, it returns the protocol and host as the server and decodes the username and password; if parsing or decoding fails, or credentials are absent, it returns the original string as the server.
  • observed — Modified behavior in src/program.ts: The --proxy-server help text now includes an authenticated HTTP proxy URL example; the option configuration is otherwise unchanged.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: passing credentials from --proxy-server as proxy username and password.
Linked Issues check ✅ Passed Directly linked issue [#43048] is closed and completed. It provides historical context only, so no linked-issue coding requirements apply.
Out of Scope Changes check ✅ Passed The changes in src/config.ts, tests/config.test.ts, src/program.ts, and SKILL.md all address proxy URL credentials or document and test that behavior. The diff shows no unrelated changes.
Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • 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.

JustasMonkev commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner Author

CI note: the failing browser-regression jobs aren't caused by this PR. The remaining Windows failures come from runner browser updates, and main hits them too. Every failure is in tests/history-downloads.integration.test.ts. None of these tests touch resolveCLIConfig or the --proxy-server parsing that this PR changes.

Head Check Failing test Status
327039c Browser regressions (ubuntu-latest, chromium) … repeated back navigation (launched, direct) #231: page.goBack: … Not attached to an active page (calls Playwright's page.goBack directly) Passed on f99ec7f
f99ec7f Browser regressions (windows-latest, chrome) #230 saves bytes or reports a known native relaunch crash … (isolated: false), poll at line 408 Failing
f99ec7f Browser regressions (windows-latest, msedge) #230 idle relaunch, poll at line 633. I re-ran the job once and it failed again. Failing

Root cause: the Windows runners auto-updated their browsers to Chrome 154.0.8037.98 and Edge 154.0.4258.53. The test logs {"case":"idle-relaunch","browser":"154.0.8037.98","knownNativeCrash":false} and {"case":"idle-relaunch","browser":"154.0.4258.53","knownNativeCrash":false}. Neither version is in observedNativeCrashes, which lists exact versions (lines 37–46). So when the documented relaunch crash happens, the test doesn't count it as a known crash, and the poll times out waiting for a save that never comes. The Edge log shows the crash happening: the relaunched download fails with download.path: Target page, context or browser has been closed. main is red the same way: the CI run for #263 (run 37190964805) failed both Windows jobs at line 633.

Proposed patch (test-only, kept out of this PR because the list deliberately requires evidence for each version and that decision is the maintainer's):

   'win32/chrome/154.0.8037.93',
+  'win32/chrome/154.0.8037.98',
   'win32/msedge/153.0.4234.48',
   'win32/msedge/154.0.4258.37',
+  'win32/msedge/154.0.4258.53',
 ]);

The evidence comes from runs 37259565237 (Chrome job 111603732206; Edge jobs 111603732220 and 111610170341). I won't push it here unless asked. Without it, these two jobs will stay red on every PR until the list is updated.


Generated by Claude Code

Comment thread src/config.ts Resolved
Comment thread src/program.ts Resolved
decodeURIComponent throws on a '%' that does not start an escape, which
dropped the credentials back into the server URL. Decode each credential
separately and keep it as typed when it is not a valid escape. Document the
proxy option and its credential handling in the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WmuRF1oEPjUCA7RC1YPci

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 327039cf43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread SKILL.md Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f99ec7f48a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config.ts Resolved
Decoding the whole credential at once failed on any stray '%', which left
valid escapes such as %40 encoded too. Decode each run of %XX escapes on
its own instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WmuRF1oEPjUCA7RC1YPci
@JustasMonkev
JustasMonkev merged commit 85901df into main Oct 5, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCP]: --proxy-server drops credentials written in the URL

2 participants