Action: a run with no report passes on exit 0; baseline name is not URL-encoded

Offen Anfängerfreundlich
#407 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
bash, github-actions, go
Bereich
ci-cd, cli

Rechercherichtung

Lies die Shell-Schritte in action.yml bei der Prüfung auf fehlende Berichte und der Suche nach Artefakten und sieh dir dann die Fälle des action-Jobs in .github/workflows/go.yml an. Reproduziere den Fall mit fehlendem Bericht mit args: -dry-run und prüfe, wie nach einem Namen gesucht wird, der + oder & enthält. Fertig, wenn beide Akzeptanzkriterien erfüllt sind und CI beide Fälle abdeckt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug github-actions good first issue severity: low

Summary

Two small edge cases in the Action's shell steps:

  • A run that writes no report succeeds when subenum exited 0.
  • A baseline-artifact name that contains &, + or # is never found again.

Where

  • action.yml:243 (no-report check), action.yml:54-61 (fail-on input doc)
  • action.yml:174-180 (artifact lookup query)

Details

No report, exit 0. After the scan the step runs:

if [ ! -s "$out/run.json" ]; then echo "::error::subenum exited $code without a report"; exit "$code"; fi

code is 0 when subenum exited 0. subenum does that without writing -stats for -dry-run (internal/cli/session.go:114-116) and for -version (session.go:213-216). The step logs an error annotation and then succeeds, although the fail-on doc says "a run with no report always fail[s]". The CI case for a missing report (go.yml:248-261) only covers a non-zero exit.

Artifact name not URL-encoded. The name is put into the query string as is:

gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$NAME&per_page=1"

upload-artifact allows &, +, # and % in names, and the Save step uploads under the raw name. With baseline-artifact: recon+prod the query asks for recon prod; with a&b it asks for a. No artifact matches, and the step prints "this run sets it" on every run.

Impact

  • With -dry-run or -version in args, the step is green but its verdict, found and results outputs are empty, so a later step gating on verdict sees an empty string instead of a failure.
  • With such an artifact name, a baseline is uploaded on every run but never downloaded: there is no diff, no changes output, and a time-boxed scan is never resumed. None of this produces an error.

Steps to reproduce

  1. uses: ./ with domain: lab.example and args: -simulate -dry-run. The step succeeds after logging ::error::subenum exited 0 without a report.
  2. Use the Action in two separate runs with baseline-artifact: subenum+prod. The second run logs "No baseline artifact named subenum+prod yet".

Suggested fix

  • Exit non-zero when the report is missing: exit $(( code == 0 ? 1 : code )).
  • URL-encode the name (enc=$(jq -rn --arg n "$NAME" '$n|@uri')), or validate baseline-artifact against ^[A-Za-z0-9._-]+$ up front and fail with a clear message.

Acceptance criteria

  • args: -dry-run fails the step
  • A baseline-artifact name with + or & round-trips, or is rejected with a clear error
  • CI cases in the action job for both

Getting started

  • Relevant files: action.yml, .github/workflows/go.yml (action job)
  • Related: #363

Filed by repo-audit/full-audit at dd5b156. Severity: low. Effort: S. audit-key: bug|action.yml|scan-no-report-exit

Vorherrschende Sprache
Go
Sterne
1
Forks
1
Ø Merge
7 Std. 18 Min.
Gemergte PRs (30 T.)
23

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/subenum

Alle Issues in TMHSDigital/subenum

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.