Skip to content

Add AWF-aware Playwright CLI policy prompt - #57594

Merged
lpcox merged 4 commits into
mainfrom
copilot/add-secure-playwright-cli-support
Sep 1, 2026
Merged

Add AWF-aware Playwright CLI policy prompt#57594
lpcox merged 4 commits into
mainfrom
copilot/add-secure-playwright-cli-support

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

  • Added actions/setup/md/playwright_awf_prompt.md, instructing the agent to:
    • bind local servers only to 127.0.0.1, never 0.0.0.0 or published ports
    • poll for loopback readiness before navigating
    • keep localhost/127.0.0.1 on the proxy bypass list; never treat the model-provider proxy as a browser proxy
    • never install packages, browsers, or system dependencies at runtime
    • clean up browser/server processes when done
  • This guidance explicitly takes precedence over generic Playwright CLI skill suggestions (e.g. npm install, npx fallback installs, navigating to arbitrary example domains).

Compiler wiring

  • Injected via collectPromptSections in pkg/workflow/unified_prompt_step.go, gated on isPlaywrightCLIMode(...) && isFirewallEnabled(...) — only appears when Playwright CLI mode and the AWF firewall/sandbox are both active, alongside the existing playwright_prompt.md section.
tools:
  playwright:
    mode: cli
sandbox:
  agent:
    id: awf

Docs

  • Documented the new AWF policy behavior in docs/src/content/docs/reference/playwright.md.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 17.5 AIC · ⌖ 8.66 AIC · ⊞ 9.2K ·
Comment /souschef to run again

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add secure first-class Playwright CLI support across AWF runtimes Add AWF-aware Playwright CLI policy prompt Sep 1, 2026
Copilot AI requested a review from lpcox September 1, 2026 03:27
@lpcox
lpcox marked this pull request as ready for review September 1, 2026 03:33
Copilot AI balanced review requested due to automatic review settings September 1, 2026 03:33

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 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.

Comment thread actions/setup/md/playwright_awf_prompt.md Outdated
Comment on lines +22 to +26
- 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot this PR is ready for the next forward-progress pass.

Please refresh the branch state if needed, address the outstanding review feedback from copilot-pull-request-reviewer, run the pr-finisher skill, and re-request review when done.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 17.5 AIC · ⌖ 8.66 AIC · ⊞ 9.2K ·
Comment /souschef to run again

@lpcox

lpcox commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot this PR is ready for the next forward-progress pass.

Please refresh the branch state if needed, address the outstanding review feedback from copilot-pull-request-reviewer, run the `pr-fini...

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.

Copilot AI requested a review from gh-aw-bot September 1, 2026 04:12
@lpcox
lpcox merged commit 9e6cfb2 into main Sep 1, 2026
45 checks passed
@lpcox
lpcox deleted the copilot/add-secure-playwright-cli-support branch September 1, 2026 04:33
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.88.0

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.

Add secure first-class Playwright CLI support across AWF runtimes

4 participants