Skip to content

fix(surfaces): skip Code Scanning upload + PR comment for remote targets#2

Merged
trustabl merged 1 commit into
mainfrom
fix/remote-target-guard
Jun 4, 2026
Merged

fix(surfaces): skip Code Scanning upload + PR comment for remote targets#2
trustabl merged 1 commit into
mainfrom
fix/remote-target-guard

Conversation

@jhumel-code

Copy link
Copy Markdown
Collaborator

From the post-merge review.

Remote-target misattribution (main correctness fix)

With a remote URL target:, the scan describes a different repo than the workflow's checkout, but uploadSarif posts to this repo's Code Scanning at this commit/ref — so the SARIF file paths don't resolve and you get orphan/misattributed alerts. Same logic applies to the sticky PR comment (it'd describe another repo). Both are now guarded behind a new isRemoteTarget(target) helper; local-path scans (the common case) are unchanged. The downloadable artifact still uploads.

Cleanups

  • Drop the unused context.isFork field (fork degradation is handled reactively by the 403 catch in sarif/comment).
  • Shorten the console footer note so it no longer overruns the box frame.

Tests

isRemoteTarget unit tests added (56 tests pass). npm run all green; dist/ rebuilt and committed.

When `target` is a remote URL the scan covers a different repo than the
checkout, so SARIF (file paths + commit) and the PR comment are scoped to the
wrong repository — uploading would misattribute Code Scanning alerts. Guard both
behind isRemoteTarget(). Also drop the unused context.isFork field and shorten
the console footer note so it no longer overruns the ASCII box.
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Trustabl scan

trustabl/trustabl-action · fix/remote-target-guard · 0 findings

Readiness now   🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩   100 / 100

Findings by severity

Severity Count
critical 0 ▱▱▱▱▱▱▱▱
high 0 ▱▱▱▱▱▱▱▱
medium 0 ▱▱▱▱▱▱▱▱
low 0 ▱▱▱▱▱▱▱▱
info 0 ▱▱▱▱▱▱▱▱
Metric Value
Repository trustabl/trustabl-action
Branch fix/remote-target-guard
Readiness score 100
Risk score 0
Findings 0
Max severity none
Native exit 0
Rules version fd790fa276dd57b810d1ef883d5a2f5f14a35a4c

✅ Passed scanning

@trustabl trustabl merged commit 5fe85ba into main Jun 4, 2026
5 checks passed
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