Skip to content

Harden workflow egress policies and pin @playwright/mcp version#694

Merged
pethers merged 16 commits intomainfrom
copilot/harden-egress-policies
Mar 1, 2026
Merged

Harden workflow egress policies and pin @playwright/mcp version#694
pethers merged 16 commits intomainfrom
copilot/harden-egress-policies

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

Hardens GitHub Actions workflows by upgrading from egress-policy: audit to egress-policy: block with explicit allowed endpoints, and reduces supply chain risk by pinning @playwright/mcp@latest to a specific version.

Changes Made

Egress Policy Hardening

  • Switched egress-policy from audit to block with allowed-endpoints in quality-checks.yml (4 jobs), javascript-testing.yml (4 jobs), and lighthouse-ci.yml (1 job)
  • Used folded YAML style (>) for allowed-endpoints to match the working deploy-s3.yml reference pattern — the Go harden-runner agent v0.14.3 parses endpoints using spaces as delimiters, so > (folded) is required; | (literal) bundles all entries into one invalid token
  • Added codeload.github.com:443 to all jobs using actions/checkout
  • Renamed summary job step from Audit all outbound callsHarden Runner (block outbound calls) to reflect enforced behavior
  • Removed unnecessary apt-get install jq step (jq is pre-installed on ubuntu-latest), eliminating the deb.debian.org:80 plaintext HTTP endpoint from the allowlist
  • Removed allowed-endpoints entirely from the summary job in quality-checks.yml — it only runs echo commands and requires zero external network access

Allowlist Completeness

  • Added data.riksdagen.se:443 and www.riksdagen.se:443 to the link-checker job in quality-checks.yml
  • Added fonts.googleapis.com:443 and fonts.gstatic.com:443 to lighthouse-ci.yml (the site loads Google Fonts; required for accurate Lighthouse audit results)
  • Added all remaining external domains linked from riksdagsmonitor.com to the link-checker's allowed-endpoints: www.hack23.com:443, www.linkedin.com:443, cia.sourceforge.io:443, data.worldbank.org:443, raw.githubusercontent.com:443, www.esv.se:443, and www.val.se:443
  • Added download.cypress.io:443 to the multi-language-sanity Cypress job in javascript-testing.yml — Cypress binary downloads can originate from this host as well as cdn.cypress.io

Dependency Pinning

  • Pinned @playwright/mcp from @latest to @0.0.68 in news-article-generator.md, news-evening-analysis.md, and news-realtime-monitor.md
  • Updated corresponding .lock.yml files to match the pinned version

Security Impact

  • Reduces supply chain attack surface by pinning @playwright/mcp
  • Enforces network egress controls (TLS-only endpoints) instead of audit-only monitoring
  • Removes plaintext HTTP egress (deb.debian.org:80) from all allowlists
  • Summary job allowlist tightened to zero endpoints (least-privilege: no network access needed)
  • Compliant with CIS Controls v8.1 Control 2 (Software Asset Management)

Testing

  • All 2255 tests pass — no regressions
  • YAML syntax verified for all modified workflow files
Original prompt

This section details on the original issue you should resolve

<issue_title>Harden workflow egress policies and pin @playwright/mcp version</issue_title>
<issue_description>## 📋 Issue Type
Security / DevSecOps

🎯 Objective

Harden GitHub Actions workflows by upgrading from egress-policy: audit to egress-policy: block with explicit allowed endpoints, and pin the @playwright/mcp@latest dependency to a specific version.

📊 Current State

  1. Egress policy: Most workflows (26+ instances) use egress-policy: audit which only monitors network traffic. Only deploy-s3.yml uses egress-policy: block with explicit allowed endpoints.
  2. Unpinned dependency: All 10 news workflows use @playwright/mcp@latest in their MCP tools configuration, which is vulnerable to supply chain attacks.
  3. Unpinned MCP packages: @smithery/cli@4.4.0 is version-pinned but @playwright/mcp@latest is not.

🚀 Desired State

  • All CI/CD workflows use egress-policy: block with minimum necessary allowed endpoints
  • @playwright/mcp pinned to a specific version (e.g., @playwright/mcp@0.0.29)
  • Supply chain attack surface reduced
  • Compliant with CIS Controls v8.1 (Control 2: Inventory and Control of Software Assets)

🔧 Implementation Approach

  1. Audit egress traffic for each workflow using existing egress-policy: audit logs
  2. Create allowed-endpoints lists for each workflow
  3. Switch from audit to block gradually (one workflow at a time)
  4. Pin @playwright/mcp to a specific version in all 10 news workflow .md files
  5. Update corresponding .lock.yml files via workflow compilation

Priority order:

  • quality-checks.yml (most frequent)
  • javascript-testing.yml (critical for CI)
  • lighthouse-ci.yml
  • News workflows (10 files)

🤖 Recommended Agent

security-architect — Supply chain security hardening

✅ Acceptance Criteria

  • All workflows use egress-policy: block with explicit allowed-endpoints
  • @playwright/mcp pinned to specific version in all news workflow .md files
  • All workflows pass after hardening
  • No legitimate network requests blocked

📚 References

🏷️ Labels

type:security, priority:high, component:ci-cd</issue_description>

<agent_instructions>Harden workflows by upgrading egress-policy from audit to block with explicit allowed-endpoints. Start with quality-checks.yml and javascript-testing.yml. Also pin @playwright/mcp to a specific version in all news workflow .md files.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Upgrade egress-policy from audit to block in quality-checks.yml (4 jobs)
- Upgrade egress-policy from audit to block in javascript-testing.yml (4 jobs)
- Upgrade egress-policy from audit to block in lighthouse-ci.yml (1 job)
- Add explicit allowed-endpoints for each job based on required network access
- Pin @playwright/mcp@latest to @playwright/mcp@0.0.68 in 3 news workflow .md files
- Update corresponding .lock.yml files to match pinned playwright/mcp version

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Harden workflow egress policies and pin playwright/mcp version Harden workflow egress policies and pin @playwright/mcp version Mar 1, 2026
@pethers pethers requested a review from Copilot March 1, 2026 02:57
@github-actions github-actions bot added documentation Documentation updates workflow GitHub Actions workflows ci-cd CI/CD pipeline changes performance Performance optimization testing Test coverage accessibility WCAG 2.1 AA compliance news News articles and content generation agentic-workflow Agentic workflow changes size-m Medium change (50-250 lines) labels Mar 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Hardens select GitHub Actions workflows by switching Step Security’s runner hardening from audit-only to enforced egress blocking with allowlists, and reduces supply-chain risk by pinning @playwright/mcp to an explicit version in news workflows.

Changes:

  • Switched egress-policy from audit to block with allowed-endpoints in quality-checks.yml, javascript-testing.yml, and lighthouse-ci.yml.
  • Pinned @playwright/mcp from @latest to @0.0.68 across three news workflow sources and their compiled lock files.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/quality-checks.yml Enforces blocked egress with per-job endpoint allowlists (plus a summary job allowlist).
.github/workflows/javascript-testing.yml Enforces blocked egress with allowlists, including Cypress CDN for the Cypress job.
.github/workflows/lighthouse-ci.yml Enforces blocked egress with allowlists for site + GCS usage.
.github/workflows/news-realtime-monitor.md Pins @playwright/mcp version in MCP tool configuration.
.github/workflows/news-realtime-monitor.lock.yml Updates compiled workflow to match pinned @playwright/mcp version.
.github/workflows/news-evening-analysis.md Pins @playwright/mcp version in MCP tool configuration.
.github/workflows/news-evening-analysis.lock.yml Updates compiled workflow to match pinned @playwright/mcp version.
.github/workflows/news-article-generator.md Pins @playwright/mcp version in MCP tool configuration.
.github/workflows/news-article-generator.lock.yml Updates compiled workflow to match pinned @playwright/mcp version.

Comment on lines 264 to 270
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
with:
egress-policy: audit
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

The step name says 'Audit all outbound calls' but the config is now egress-policy: block. Rename the step to reflect the enforced behavior (e.g., 'Harden runner (block outbound calls)') to avoid confusion when reading logs.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0fb0dc7 — renamed to Harden Runner (block outbound calls).

Comment on lines 19 to 25
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
nodejs.org:443
objects.githubusercontent.com:443
registry.npmjs.org:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

Using YAML folded style (>) will fold newlines into spaces, producing a single-line string. If step-security/harden-runner expects newline-delimited endpoints, this can cause the allowlist to be misparsed. Prefer literal style (|) to preserve line breaks for endpoint lists.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0fb0dc7 — switched all allowed-endpoints blocks from folded style (>) to literal style (|) across all three workflows.

egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

actions/checkout typically downloads the repository archive from codeload.github.com (not github.com). With egress-policy: block, the checkout step can fail unless codeload.github.com:443 is included in allowed-endpoints for jobs that use actions/checkout.

Suggested change
github.com:443
github.com:443
codeload.github.com:443

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0fb0dc7 — added codeload.github.com:443 to every job that uses actions/checkout (3 jobs in quality-checks.yml, 3 in javascript-testing.yml, 1 in lighthouse-ci.yml).

@pethers
Copy link
Member

pethers commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

- Fix step name: 'Harden the runner (Audit all outbound calls)' -> 'Harden Runner (block outbound calls)'
- Change allowed-endpoints YAML from folded style (>) to literal style (|) in all 3 workflows
- Add codeload.github.com:443 to all jobs using actions/checkout (9 jobs across 3 workflows)

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

objects.githubusercontent.com:443
registry.npmjs.org:443
riksdagsmonitor.com:443
www.riksdagen.se:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

The link-checker job runs linkinator https://riksdagsmonitor.com/ and (per the current --skip regex) will attempt to validate external links on the homepage beyond the riksdagen.se domains (e.g., links to www.hack23.com and www.linkedin.com are present in index.html). With egress-policy: block, those requests will be blocked and inflate the external-links report with false failures. Either add the relevant domains (e.g., www.hack23.com:443, www.linkedin.com:443) to allowed-endpoints, or extend the --skip pattern to exclude them so the report reflects real link issues rather than egress blocks.

Suggested change
www.riksdagen.se:443
www.riksdagen.se:443
www.hack23.com:443
www.linkedin.com:443

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c620e77 — added www.hack23.com:443 and www.linkedin.com:443 as requested, plus all other external domains linked from index.html that would be blocked: cia.sourceforge.io:443, data.worldbank.org:443, raw.githubusercontent.com:443, www.esv.se:443, and www.val.se:443.

@pethers
Copy link
Member

pethers commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Add all external domains linked from riksdagsmonitor.com that the
linkinator external check would visit:
- www.hack23.com:443 and www.linkedin.com:443 (per review comment)
- cia.sourceforge.io:443, data.worldbank.org:443
- raw.githubusercontent.com:443, www.esv.se:443, www.val.se:443

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

Done in c620e77 — added all missing external domains to the link-checker's allowed-endpoints.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment on lines 274 to 276
allowed-endpoints: >
api.github.com:443
github.com:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

The summary job appears to only emit a local summary (no checkout/install shown in this hunk), but it still permits outbound access to GitHub/API. If the job truly doesn’t require network egress, tightening this to an empty allowlist (or removing allowed-endpoints entirely, depending on the action’s expectations) would reduce the allowed attack surface.

Suggested change
allowed-endpoints: >
api.github.com:443
github.com:443

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 813c03e — removed the allowed-endpoints block entirely from the summary job. It only runs echo commands with no network access needed.

Comment on lines 149 to 157
egress-policy: block
allowed-endpoints: >
api.github.com:443
cdn.cypress.io:443
codeload.github.com:443
github.com:443
nodejs.org:443
objects.githubusercontent.com:443
registry.npmjs.org:443
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

Cypress installs commonly download the binary from download.cypress.io (and/or related hosts) rather than only cdn.cypress.io. If this job performs a fresh Cypress install/download, the current allowlist may block it. Consider adding download.cypress.io:443 (or confirming the exact host(s) used by the Cypress download in this workflow) to avoid intermittent failures on cold caches.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 813c03e — added download.cypress.io:443 to the multi-language-sanity job's allowlist alongside the existing cdn.cypress.io:443.

@pethers
Copy link
Member

pethers commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

- Remove allowed-endpoints from summary job in quality-checks.yml:
  the job only runs echo commands and needs zero external network access
- Add download.cypress.io:443 to multi-language-sanity Cypress job in
  javascript-testing.yml: Cypress binary downloads can originate from
  download.cypress.io as well as cdn.cypress.io

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 1, 2026

@copilot apply changes based on the comments in this thread

Done in 813c03e — both changes applied: summary job allowed-endpoints removed (zero network access needed), and download.cypress.io:443 added to the Cypress job.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@pethers pethers marked this pull request as ready for review March 1, 2026 13:48
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers merged commit 982000d into main Mar 1, 2026
11 checks passed
@pethers pethers deleted the copilot/harden-egress-policies branch March 1, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility WCAG 2.1 AA compliance agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation performance Performance optimization size-m Medium change (50-250 lines) testing Test coverage workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden workflow egress policies and pin @playwright/mcp version

3 participants