Skip to content

Commit 38982f9

Browse files
committed
PlaywrightProvider: self-contain CLAUDE_SANDBOX_NO_PROXY + forward via sudo env wrapper
Two Devin review findings: 1. binprovider_playwright.py imported CLAUDE_SANDBOX_NO_PROXY from binprovider_puppeteer.py, violating the "each binprovider owns its own provider-specific logic" rule in AGENTS.md. Define the constant locally instead. 2. exec() already wraps commands with /usr/bin/env KEY=VAL so that PLAYWRIGHT_BROWSERS_PATH survives sudo's env_reset, but the NO_PROXY / no_proxy values set by ENV were not being forwarded via the same mechanism -- sudo stripped them before reaching playwright, defeating the sandbox NO_PROXY fix on Linux (where euid=0 routes every subprocess through sudo -n). Forward NO_PROXY/no_proxy as CLI-arg assignments alongside PLAYWRIGHT_BROWSERS_PATH.
1 parent 85106ad commit 38982f9

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

abxpkg/binprovider_playwright.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@
2323
from .binary import Binary
2424
from .binprovider import BinProvider, EnvProvider, log_method_call, remap_kwargs
2525
from .binprovider_npm import NpmProvider
26-
from .binprovider_puppeteer import CLAUDE_SANDBOX_NO_PROXY
2726
from .logging import format_command, format_subprocess_output, get_logger
2827
from .semver import SemVer
2928

3029
logger = get_logger(__name__)
3130

31+
CLAUDE_SANDBOX_NO_PROXY = (
32+
"localhost,127.0.0.1,169.254.169.254,metadata.google.internal,"
33+
".svc.cluster.local,.local"
34+
)
35+
3236

3337
class PlaywrightProvider(BinProvider):
3438
"""Playwright browser installer provider.
@@ -319,6 +323,15 @@ def exec(
319323
env_assignments.append(
320324
f"PLAYWRIGHT_BROWSERS_PATH={cache_dir}",
321325
)
326+
# ``NO_PROXY`` / ``no_proxy`` are set by ``ENV`` to rescue
327+
# browser downloads in sandboxes whose egress proxy NO_PROXY
328+
# blocks ``cdn.playwright.dev`` / ``storage.googleapis.com``.
329+
# They must also survive sudo's ``env_reset``, so forward them
330+
# through the ``/usr/bin/env KEY=VAL -- ...`` wrapper below.
331+
for proxy_key in ("NO_PROXY", "no_proxy"):
332+
proxy_value = env.get(proxy_key)
333+
if proxy_value:
334+
env_assignments.append(f"{proxy_key}={proxy_value}")
322335
needs_sudo_env_wrapper = os.geteuid() != 0 and self.EUID != os.geteuid()
323336
if env_assignments and needs_sudo_env_wrapper:
324337
resolved_bin = bin_name

0 commit comments

Comments
 (0)