Skip to content

Protect agent step summary publication from symlink traversal - #76958

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/ai-scan-summary-safety
Nov 11, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/ai-scan-summary-safety

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Addresses AI Scan alert 1093: agent-controlled summary symlinks could reach host files when secret redaction failed or silently skipped inaccessible directories.

  • Publish through the existing guarded-file reader, which pins directory descriptors and rejects source/ancestor symlinks, nonregular files, and path replacements instead of checking and reopening a pathname.
  • Require successful built-in and custom redactor outcomes before publication, including when a failed hook uses continue-on-error. Inaccessible scans now fail redaction closed.
  • Preserve ordinary, missing, and empty summaries. Guarded publication is Linux-only and accepts isolated regular files up to 10 MiB.

The 365 regenerated workflow locks contain only the required summary condition change from always() to always() && steps.redact_secrets.outcome == 'success'. Workflow Markdown sources, including upstream-managed sources, are unchanged; locks were regenerated by make recompile, not manually edited.

Validation

  • make agent-report-progress passed, including build, scoped lint, impacted tests, typecheck, and workflow drift checks.
  • Focused compiler gate and ARC path tests passed.
  • Linux Node 24 non-root regressions: 224 passed, one platform-specific test skipped. Cases include source/ancestor links, searchable-but-unlistable directories, redaction and unlink failures, descriptor races, nonregular files, unchanged external sentinels, and the deployed shell wrapper.
  • Setup runtime deployment tests: 29 passed.

Related alert dispositions

  • 1091 and 1092: unchanged. The collector runs in separate downstream jobs after artifact downloads; a surviving attacker-controlled symlink across that boundary was not established.
  • 1089 and 1090: unchanged. The flagged shell patch generator has no production caller; production uses the CJS implementation.

No alerts were dismissed or suppressed, and no workflows were dispatched.

Require successful built-in and custom redaction before publishing summaries, fail inaccessible scans closed, and reuse descriptor-safe regular-file snapshots. Regenerate only the required summary publication conditions in workflow locks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 20:40
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 20:40
@pelikhan
pelikhan marked this pull request as draft November 11, 2026 21:30
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 21:30
@github-actions

github-actions Bot commented Nov 11, 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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Commit pushed: cd54f54

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 from PR Specification Reviewer · gpt56 · ~9 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76958

@github-actions

github-actions Bot commented Nov 11, 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

@github-actions

github-actions Bot commented Nov 11, 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 from Ponytail Reviewer · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76958

@github-actions

github-actions Bot commented Nov 11, 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.

Generated from Design Decision Gate 🏗️ · routed: sonnet55 high · ~6 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions github-actions Bot 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.

Reviewed the changed lines and found no actionable correctness, security, or maintainability issues. The redaction gating and guarded summary publication changes are consistent with the accompanying tests and documentation. Static review only; tests were not run per review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@github-actions github-actions Bot 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.

Reviewed PR head be5e340d4f7cc5f8437c5cb07d75bbe22df39c20 against the compiler threat-detection contracts. The implementation and evidence align with the existing CTR-017 secret-leakage/publication boundary: summary publication is gated on successful masking, redaction fails closed, and guarded Linux no-follow reads reject unsafe files and races. No blocking conformance finding identified. Synchronized and queued specs/compiler-threat-detection-spec.md to v1.0.100 and its changelog; commit 8cc559c is queued for the same-repository PR branch. Static review only; tests were not run by this reviewer.

Generated by PR Specification Reviewer for #76958 · copilot · gpt50 · ~9 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd. Requesting changes on one contract mismatch in the publisher; the rest of the hardening looks sound.

📋 Key Themes & Highlights

Key Themes

  • Missing-summary contract: off Linux, withGuardedDirectory throws before the ENOENT no-op can run, so a missing summary fails the step. This contradicts the README and PR body.
  • Behavior change: removing the EACCES/EPERM skip in redact_secrets.cjs is intended fail-closed, but it needs a release note.
  • Lock drift: not cited. Local archie.lock.yml differs from HEAD, but the Go source emits the correct gated condition.

Positive Highlights

  • ✅ Descriptor-pinned reads with O_NOFOLLOW and dev/ino checks, plus a 10 MiB cap.
  • ✅ Fail-closed on unlink failure during redaction.
  • ✅ Tests cover source and ancestor symlinks, FIFOs, directories, and descriptor-race replacement.
  • ✅ The gating test now expects the summary step among the three uploads.

Open Question

I could not confirm which shell runs the summary step on Windows. It is a plain run: bash with no shell: override. If it runs under Git Bash, process.platform is win32 and the publisher fails on every run. Please confirm.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

try {
let content;
try {
content = readGuardedFile(path.join(process.env.GH_AW_TMP_DIR || "/tmp/gh-aw", "agent-step-summary.md"));

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.

[/diagnosing-bugs] The missing-summary no-op is bypassed off Linux. withGuardedDirectory throws an assetValidationError with no ENOENT code on non-Linux, so this catch rethrows and the step exits 1 even when agent-step-summary.md does not exist. That conflicts with the README and the PR body, which say missing or empty summaries remain a no-op.

💡 Suggested fix

Check for the file before the platform check, for example with an lstat that returns early on ENOENT, so the fail-closed path applies only when a summary is present. Alternatively, add a non-Linux test for the missing-file case and confirm that no non-Linux runner executes this step.

@copilot please address this.

if (isErrnoCode(error, "EACCES", "EPERM")) {
core.warning(`Skipping inaccessible directory during secret redaction: ${currentDir}`);
continue;
}
throw error;

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.

[/diagnosing-bugs] Removing the EACCES/EPERM skip is a deliberate fail-closed change, but it can turn previously green runs red when a directory in the scan tree is unreadable. The new tests cover the failure path, but nothing shows that a readable tree behaves as before, and the behavior change is not called out for users.

💡 Suggested follow-up

Add a release note explaining why unreadable directories now block publication. Consider a test that confirms readable trees still redact normally after the change.

@copilot please address this.

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan merged commit a0b52af into main Nov 11, 2026
63 checks passed
@pelikhan
pelikhan deleted the pelikhan/ai-scan-summary-safety branch November 11, 2026 23:41
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

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

3 participants