Skip to content

Prevent zip option injection from staged filenames - #78015

Merged
pelikhan merged 2 commits into
mainfrom
copilot/vulnhunter-fix-injection-issue
Nov 15, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/vulnhunter-fix-injection-issue

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

createZipFromFiles passed staged paths directly to zip, allowing a leading-dash filename such as -T to be interpreted as an option. Reject these filenames during staging and archive creation, and prefix archive members with ./.

  • Archive arguments: Prefix each member path so it is treated as a filename:
    ["-q", "-r", outputPath, "./file.txt"]
  • Staging validation: Reject leading-dash filenames before copying or uploading them.
  • Regression coverage: Verify -T is rejected and regular member paths are safely passed to zip.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@gh-aw-bot gh-aw-bot changed the title [WIP] Fix argument injection vulnerability in artifact_client Prevent zip option injection from staged filenames Nov 15, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 15, 2026 08:09
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 08:09
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #78015 · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #78015 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@pelikhan
pelikhan merged commit 753dfcd into main Nov 15, 2026
78 checks passed
@pelikhan
pelikhan deleted the copilot/vulnhunter-fix-injection-issue branch November 15, 2026 08:13

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

A file entry equal to the root directory bypasses validation and becomes ./, causing zip -r to archive the entire root, including unselected files.

2 open issues
What changed in this PR

This PR hardens artifact uploads against zip option injection from staged filenames, addressing #78012.

Changes:

  • Reject leading-dash filenames during staging and archive creation.
  • Prefix archive members with ./ and ensure temporary-directory cleanup on archive errors.
  • Add regression coverage for filename rejection and safe zip arguments.
File Description
actions/​setup/​js/​upload_artifact.test.cjs Tests rejection of staged and auto-copied leading-dash filenames.
actions/​setup/​js/​upload_artifact.cjs Validates filenames before copying or uploading.
actions/​setup/​js/​artifact_client.test.cjs Tests archive rejection and explicit zip member arguments.
actions/​setup/​js/​artifact_client.cjs Validates and prefixes archive members; protects cleanup on failure.

Review effort: Max (dynamic)

ensureZipAvailable();
const relativeFiles = files.map(file => path.relative(rootDirectory, file));
const invalid = relativeFiles.find(rel => !rel || rel.startsWith("..") || path.isAbsolute(rel));
if (invalid) {
Comment on lines +283 to +288
const spawnSyncSpy = vi.spyOn(childProcess, "spawnSync");

const client = new DefaultArtifactClient();
await expect(client.uploadArtifact("artifact", [filePath], tmpDir)).rejects.toThrow("leading-dash filenames");

expect(spawnSyncSpy).not.toHaveBeenCalled();
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.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.

[vulnhunter] VulnHunter findings in github/gh-aw

4 participants