Add AWF-aware Playwright CLI policy prompt - #57594
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The prompt incorrectly claims browser staging and enforced proxy routing that remain deferred follow-up work.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds AWF-specific Playwright CLI policy guidance and compiler injection when the firewall is active.
Changes:
- Adds secure loopback, proxy, installation, and cleanup guidance.
- Wires the policy into unified prompts with gating tests.
- Updates documentation and compiler golden outputs.
File summaries
| File | Description |
|---|---|
actions/setup/md/playwright_awf_prompt.md |
Defines the AWF Playwright policy. |
pkg/workflow/unified_prompt_step.go |
Conditionally injects the policy. |
pkg/workflow/prompt_constants.go |
Registers the prompt filename. |
pkg/workflow/prompts_test.go |
Tests firewall-based inclusion. |
docs/src/content/docs/reference/playwright.md |
Documents policy behavior. |
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden |
Updates CLI-mode output. |
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden |
Updates smoke output. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| - Traffic to `localhost`/`127.0.0.1` is served directly; all other HTTP/HTTPS | ||
| browser traffic is routed through the sandbox's proxy and is subject to the | ||
| workflow's domain allowlist. Do not attempt to change browser proxy | ||
| settings, bypass rules, or the proxy environment variables — they are | ||
| enforced by the sandbox, not by this agent. |
There was a problem hiding this comment.
Addressed in aceb416: reworded this section to state the required behavior (keep localhost/127.0.0.1 on the bypass list, route everything else through the proxy) and instruct the agent to fail closed and report the failure if the expected proxy topology isn't in place, rather than implying enforcement already exists.
|
@copilot this PR is ready for the next forward-progress pass. Please refresh the branch state if needed, address the outstanding review feedback from
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "github.com"See Network Configuration for more information.
|
|
@copilot run pr-finisher skill |
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in aceb416: removed the false "already staged" claim for the Playwright CLI/Chromium and reworded the proxy guidance as a required behavior that must fail closed if the expected bypass/proxy topology isn't in place, rather than implying it's already enforced. |
|
🎉 This pull request is included in a new release. Release: |
Playwright CLI mode in AWF sandboxes needs an enforced secure browser topology (loopback-only servers, Squid-routed egress) rather than relying solely on generic upstream skill guidance that suggests runtime installs or arbitrary navigation. This is a first, self-contained slice of a larger multi-part hardening effort (compiler-staged/pinned CLI+Chromium assets, cross-runtime mounts, an in-sandbox pre-agent lifecycle hook, and enforced Docker sbx egress remain as follow-up work).
Policy prompt
actions/setup/md/playwright_awf_prompt.md, instructing the agent to:127.0.0.1, never0.0.0.0or published portslocalhost/127.0.0.1on the proxy bypass list; never treat the model-provider proxy as a browser proxynpm install,npxfallback installs, navigating to arbitrary example domains).Compiler wiring
collectPromptSectionsinpkg/workflow/unified_prompt_step.go, gated onisPlaywrightCLIMode(...) && isFirewallEnabled(...)— only appears when Playwright CLI mode and the AWF firewall/sandbox are both active, alongside the existingplaywright_prompt.mdsection.Docs
docs/src/content/docs/reference/playwright.md.Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
github.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.