Skip to content

Fix gh-aw-node brace-expansion patch: replace broken npm --prefix overlay with temp-dir copy (GHSA-mh99-v99m-4gvg) - #49853

Merged
pelikhan merged 2 commits into
mainfrom
copilot/container-image-scan-update-again
Aug 2, 2026
Merged

Fix gh-aw-node brace-expansion patch: replace broken npm --prefix overlay with temp-dir copy (GHSA-mh99-v99m-4gvg)#49853
pelikhan merged 2 commits into
mainfrom
copilot/container-image-scan-update-again

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

The published ghcr.io/github/gh-aw-node image contains brace-expansion@5.0.7 (GHSA-mh99-v99m-4gvg, High). The previous Dockerfile fix was silently a no-op.

Root cause

npm install --prefix "$(npm root -g)/npm" reads npm's own package.json at that prefix, which declares @npmcli/docs@^1.0.0 — a private package not on the public registry. The install exits E404 before touching brace-expansion, so the bundled 5.0.7 was never replaced.

Changes

  • Dockerfile.safe-outputs-mcp — replace the broken --prefix npm-dir approach with a temp-directory overlay:

    # Before (broken: reads npm's own package.json → E404 for @npmcli/docs)
    && npm install --prefix "$(npm root -g)/npm" --no-save "tar@^7.5.22" "brace-expansion@^5.0.8"
    
    # After (correct: empty temp prefix → installs only what's requested, then overlay)
    && tmpdir=$(mktemp -d) \
    && npm --prefix "$tmpdir" install --no-save "tar@^7.5.22" "brace-expansion@^5.0.8" \
    && npm_modules="$(npm root -g)/npm/node_modules" \
    && cp -rf "$tmpdir/node_modules/brace-expansion/." "$npm_modules/brace-expansion/" \
    && cp -rf "$tmpdir/node_modules/tar/." "$npm_modules/tar/" \
    && rm -rf "$tmpdir"

    With brace-expansion@^5.0.8 now resolving to 5.0.9 (published 2026-07-30), the rebuilt image will have the patched version in npm's bundled node_modules.

  • publish-safe-outputs-node.yml — add push trigger scoped to actions/setup/js/Dockerfile.safe-outputs-mcp on main, so the image rebuilds immediately on merge rather than waiting for the next Monday schedule.

Note: After the image is rebuilt, action_pins.json, docker_pin_test.go, and compiled lock files will need a follow-up update with the new image digest.

Copilot AI linked an issue Aug 2, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for tackling the container image vulnerabilities (@copilot-swe-agent)! 🛡️ This PR is off to a good start with a clear description of the issue and remediation goals.

A few things to keep an eye on as you develop this:

  • Add test coverage — Once you update the Dockerfile or container build process, consider adding validation tests (e.g., scanning the built image to confirm vulnerability counts are reduced, or verifying license policy compliance).
  • Include the actual changes — This is currently a [WIP] draft with no file changes yet. Once you push the Dockerfile updates or build script modifications, the diff will show the specific package version updates and remediation steps.

The PR description is excellent and gives clear context on what needs to be done. Keep it updated as you make progress, and feel free to mark it as ready for review once the implementation is complete and tested.

Generated by ✅ Contribution Check · auto · 46.3 AIC · ⌖ 17.4 AIC · ⊞ 8.8K ·

…hing in Dockerfile

The previous approach (npm install --prefix "$(npm root -g)/npm") was broken because
it reads npm's own private package.json (referencing @npmcli/docs which is not public).

Replace with a temp-directory overlay: install brace-expansion >=5.0.8 and tar >=7.5.22
into a fresh prefix with no package.json, then cp into npm's bundled node_modules.

Also add a push trigger to publish-safe-outputs-node.yml on the Dockerfile path so the
image rebuilds automatically when this change is merged to main.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update container image to address vulnerabilities Fix gh-aw-node brace-expansion patch: replace broken npm --prefix overlay with temp-dir copy (GHSA-mh99-v99m-4gvg) Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 21:38
@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 21:39
Copilot AI review requested due to automatic review settings August 2, 2026 21:39
@pelikhan
pelikhan merged commit 3117bb7 into main Aug 2, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/container-image-scan-update-again branch August 2, 2026 21:42

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.

Pull request overview

Fixes vulnerable bundled npm dependencies in the gh-aw-node image and ensures Dockerfile changes trigger publication.

Changes:

  • Installs patched dependencies in a temporary prefix and overlays them into npm.
  • Triggers image publication when the Dockerfile changes on main.
  • Adds a patch changeset.
Show a summary per file
File Description
actions/setup/js/Dockerfile.safe-outputs-mcp Replaces the broken npm dependency patching approach.
.github/workflows/publish-safe-outputs-node.yml Adds Dockerfile-scoped push publication.
.changeset/patch-refresh-gh-aw-node.md Documents the security fix and publication trigger.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +7 to +11
push:
branches:
- main
paths:
- 'actions/setup/js/Dockerfile.safe-outputs-mcp'
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.3

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.

[container-image-scan] test title

3 participants