Skip to content

fix(ci): build the scanner, not the caller, in scan-and-report.yml - #286

Merged
hyperpolymath merged 1 commit into
mainfrom
marina/optimistic-cray-js64k7
Nov 10, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
marina/optimistic-cray-js64k7

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Refs #276 and #212. This pull request does not close #276 by itself: the first acceptance criterion needs a hosted run from an external caller (see "Not shown yet").

Symptom

Every repository that calls scan-and-report.yml as a reusable workflow fails at Run scan with exit 127: ./target/release/panic-attack does not exist. Observed on hyperpolymath/echidna main, Security Scan run 42351376316.

Cause

In a reusable workflow, actions/checkout with no repository: checks out the caller. The step cargo build --locked --release therefore built the caller's crate. It worked only when this repository ran the workflow on itself.

Change

The workflow now fetches the scanner source at the commit of this workflow file and builds that.

  • Source: job.workflow_repository at job.workflow_sha. GitHub documents both as the repository and commit of the workflow file that defines the job.
  • Location: the runner's temp directory, outside the workspace. The scan cannot report on the scanner's own files.
  • Refusals: the fetch step exits 2 for a repository that is not owner/name and for a commit that is not a full SHA. It also checks that the fetched HEAD is that SHA.
  • Cache: the cache step keys on the scanner's workspace, not the caller's.
  • Scan step: it takes the target path from the environment and quotes it.

No uses: reference changes, so actions.lock is unchanged.

One difference from the proposal in #276: the proposal names hyperpolymath/panic-attack as a literal. This change takes the repository from job.workflow_repository, so a rename of this repository cannot break the fetch.

Acceptance criteria

Criterion State
An external caller reaches Run scan, and the binary exists Local run only. Needs a hosted run from an external caller.
This repository's own run still builds the commit under test Hosted workflow_dispatch run on this branch: see the comment below when it completes.
The report contains no findings from the scanner source Holds by construction: the source is outside the workspace. The local report names no scanner path.

Evidence (local)

I extracted the changed steps from the workflow file and ran them on x86_64 Linux with cargo 1.97.0.

  • Fetch: succeeds at c7b1c44 (main at that time). It is refused with exit 2 for main, a short SHA, a malformed repository and an empty repository.
  • Build: 3 min 14 s. The binary exists at the path that the scan step uses.
  • Scan: a checkout of hyperpolymath/echidna as the caller. Exit 0, schema 2.6 report, 951 of 951 files analysed, 130 weak points. The report names no scanner source path, and no scanner source is inside the workspace.

Not shown yet

That job.workflow_sha names this repository's commit inside a call from another repository. The local run cannot show it. A caller must pin a commit that contains this change; echidna's security-scan.yml still pins be6ac46.


Generated by Claude Code

Every repository that calls scan-and-report.yml as a reusable workflow
failed at "Run scan" with exit 127: ./target/release/panic-attack did
not exist. In a reusable workflow, actions/checkout with no repository
checks out the caller, so "cargo build" built the caller's crate. The
step worked only when this repository ran the workflow on itself.

Fetch the scanner source at the commit of this workflow file
(job.workflow_repository at job.workflow_sha) and build that:

- a caller that pins scan-and-report.yml@<sha> gets the scanner at
  that SHA, never main by name (the #212 property);
- a run of this workflow in its own repository still builds the commit
  under test;
- the source goes to the runner's temp directory, outside the
  workspace, so the scan cannot report on the scanner's own files.

The fetch step refuses a repository that is not owner/name and a commit
that is not a full SHA, and checks that the fetched HEAD is that SHA.
The cache step now keys on the scanner's workspace, not the caller's.
The scan step takes the target path from the environment and quotes it.

No uses: reference changes, so actions.lock is unchanged.

Local run of the changed steps, extracted from the workflow file
(x86_64 Linux, cargo 1.97.0): the fetch at c7b1c44 succeeds and is
refused for "main", a short SHA and a malformed repository; the build
takes 3 min 14 s and leaves the binary; the scan of a checkout of
hyperpolymath/echidna as the caller exits 0 with a schema 2.6 report
(951 of 951 files) that names no scanner source path.

Not shown locally: that job.workflow_sha names this repository's commit
inside a call from another repository. That needs a hosted run from an
external caller.

Refs #276, #212

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136P7ZmAsYpFA9gxfQLF3F6
Signed-off-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8ebab2a3-bbdd-4f0f-8428-ebcefe51d293
Commits

Reviewing files that changed from the base of the PR and between c7b1c44 and e55cb1e.

Files selected for processing: 1

  • .github/workflows/scan-and-report.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 10, 2026 17:14
@hyperpolymath
hyperpolymath merged commit 4f51cca into main Nov 10, 2026
68 of 70 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hyperpolymath
hyperpolymath deleted the marina/optimistic-cray-js64k7 branch November 10, 2026 17:14
hyperpolymath added a commit that referenced this pull request Nov 10, 2026
Follow-up to #286. Refs #276.

## What failed

Run 42862049822 was the first run of `scan-and-report.yml` by
`workflow_dispatch`. It ran on the #286 branch before the merge.

- The new steps of #286 passed: the fetch of the scanner source and the
build (2 min 33 s).
- **Run scan** failed with exit 2: `a value is required for '<TARGET>'
but none was supplied`.

## Cause

`repo_path` and `fail_on_severity` are declared under `workflow_call`
only. A `workflow_dispatch` run has its own `inputs` context, so both
values were empty strings.

- The scan had no target.
- The severity gate would then reject the empty threshold
(`fail_on_severity must be one of ...`).

The step before #286 expanded the same empty input, so this path did not
work before #286 either. #286 did not cause it. The first manual run
showed it.

## Change

Declare both inputs under `workflow_dispatch`, with the same names and
the same defaults (`.` and `none`).

The expressions in the steps do not change. An explicit bad value from a
caller is still refused.

## Evidence

A hosted `workflow_dispatch` run on this branch is the proof. I add its
result in a comment when it completes.

This pull request does not show the external caller case of #276. That
still needs a caller that pins a commit with #286, for example echidna's
`security-scan.yml`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_0136P7ZmAsYpFA9gxfQLF3F6)_

Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
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.

scan-and-report.yml: "Build the commit under test" builds the caller, so every external caller dies at "Run scan" (exit 127)

3 participants