Skip to content

ci(pr): InspectCode builds PR code with no write scope; SARIF upload moves to a no-checkout job - #360

Merged
Chris-Wolfgang merged 1 commit into
mainfrom
ci/inspectcode-sarif-upload-split
Sep 21, 2026
Merged

Chris-Wolfgang merged 1 commit into
mainfrom
ci/inspectcode-sarif-upload-split

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

Template sync of Chris-Wolfgang/repo-template#594 — closes the one real gap behind the Scorecard Dangerous-Workflow / CodeQL untrusted-checkout alerts on pr.yaml.

Job Before After
inspectcode ("ReSharper InspectCode") checkout PR head → build → jb inspectcode → upload-sarif → gate; security-events: write checkout PR head → build → jb inspectcode → artifact hand-off (runs even when the gate fails) → gate; contents: read only
inspectcode-upload (new) — checkout trusted base ref (never PR code) → download artifact → upload-sarif; the only job with security-events: write

Net: no job that executes PR code holds any write scope, so a PR's MSBuild targets / tests / analyzers cannot forge or dismiss Code Scanning alerts through the job token. The required-check name ReSharper InspectCode is unchanged. Scorecard / CodeQL keep flagging the pull_request_target + PR-head-checkout shape (they cannot see the scope split); those alerts are dismissed per repo with this reason.

Configuration-only PR (passes the protected-file guard); bypass merge.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings September 20, 2026 15:07

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

…moves to a no-checkout job

Template sync of Chris-Wolfgang/repo-template#594. The inspectcode job holds contents: read only and hands inspect.sarif off as a 1-day artifact; a new inspectcode-upload job — which checks out the trusted base ref, never PR code — is the only job with security-events: write. The upload still runs when the error-severity gate fails and ends quietly when no SARIF was produced. Same-repo guard on the build job lifted (nothing left to protect).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Chris-Wolfgang
Chris-Wolfgang force-pushed the ci/inspectcode-sarif-upload-split branch from 23a24fe to 1978e75 Compare September 21, 2026 00:43
@Chris-Wolfgang
Chris-Wolfgang merged commit 5a24755 into main Sep 21, 2026
17 checks passed
@Chris-Wolfgang
Chris-Wolfgang deleted the ci/inspectcode-sarif-upload-split branch September 21, 2026 01:16
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.

2 participants