Skip to content

Harden Build Failure Analysis archive extraction - #17670

Merged
Evangelink merged 3 commits into
dotnet:mainfrom
YuliiaKovalova:fix-bfa-archive-entry-validation
Oct 8, 2026
Merged

Evangelink merged 3 commits into
dotnet:mainfrom
YuliiaKovalova:fix-bfa-archive-entry-validation

Conversation

@YuliiaKovalova

@YuliiaKovalova YuliiaKovalova commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • validate ZIP entry metadata before extracting untrusted Azure Pipelines artifacts in both Build Failure Analysis workflows
  • reject absolute/traversal/drive paths and symlink, device, FIFO, socket, or other special entries
  • cap archives at 65,536 entries and exercise both production validators with regression fixtures
  • pin the current binlog MCP image digest while keeping the runtime reference tag-only

Validation

  • python .github/workflows/tests/test_archive_validation.py
  • gh-aw v0.86.2 strict compile + schema validation: 2 workflows, 0 warnings
  • actionlint v1.7.12 with the documented gh-aw extension ignores
  • full CIBuild.cmd -prepareMachine -configuration Release reached build, pack, and tests; it failed only in product tests unrelated to this .github-only diff:
    • CentralPackageManagementTests.ImplicitPackageReferences_ShouldNotConflictWithPackageVersionEntries: existing Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild package-version conflict in product sources unchanged from upstream/main
    • MsiTests.ItCanBuildATemplatePackMsi: local environment could not find MSBuild\Current\Bin\MSBuild.exe

Copilot AI balanced review requested due to automatic review settings October 7, 2026 14:38

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.

Copilot review overview

🟡 Changes recommended

ZIP entry limits are enforced only after the untrusted central directory is fully materialized, leaving a memory-exhaustion path.

Review effort: Balanced
Findings: 2 High severity

Open (2)
What changed in this PR

Hardens untrusted Azure Pipelines artifact extraction in both Build Failure Analysis workflows.

Changes:

  • Validates ZIP paths, entry types, and entry counts before extraction.
  • Adds regression tests for unsafe archives.
  • Pins the binlog MCP container digest.
File Description
.github/​workflows/​tests/​test_archive_validation.py Tests both production validators.
.github/​workflows/​tests/​.gitignore Ignores Python cache files.
.github/​workflows/​build-failure-analysis.md Adds archive metadata validation.
.github/​workflows/​build-failure-analysis.lock.yml Regenerates the compiled workflow.
.github/​workflows/​build-failure-analysis-command.md Adds validation to the command workflow.
.github/​workflows/​build-failure-analysis-command.lock.yml Regenerates the compiled command workflow.
.github/​aw/​actions-lock.json Records pinned container digests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI balanced review requested due to automatic review settings October 7, 2026 15:19

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

Forged size metadata and ASi Unix extra fields can still bypass the intended extraction safeguards.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 7, 2026 15:44

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.

🔵 Needs a closer look

The security-critical archive parser and generated workflow changes warrant final human review despite comprehensive regression coverage.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

@Evangelink
Evangelink merged commit 1068161 into dotnet:main Oct 8, 2026
2 of 6 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 14, 2026
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.

3 participants