Skip to content

Fix(fuzz): Convert fuzz_seconds to a number - #378

Merged
ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-377
Nov 22, 2026
Merged

ModeSevenIndustrialSolutions merged 1 commit into
lfreleng-actions:mainfrom
lfreleng-bot-forks:code-monkey/issue-377

Conversation

@lf-releng-code-monkey-bot

@lf-releng-code-monkey-bot lf-releng-code-monkey-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #377

Authored by an AI agent; human review required
Command Exit
uv run pytest -q .github/scripts/tests/test_fuzz_workflow.py 0
uv run pytest -q .github/scripts/tests/test_fuzz_workflow.py (against the previous workflow, expected to fail) 1
uv run pytest -q 0
prek run --files .github/scripts/tests/test_fuzz_workflow.py .github/workflows/fuzz-sarif-publish.yaml README.md 0
uvx zizmor --offline --persona auditor .github/workflows/fuzz-sarif-publish.yaml 0
bash scripts/agents/aislop-gate.sh 805caa29f7475dcaae3aca673d3e695f4a7fcbef 3
uv run --with ruff bash scripts/agents/aislop-gate.sh 805caa29f7475dcaae3aca673d3e695f4a7fcbef 0
prek run gitlint --hook-stage commit-msg --commit-msg-filename <commit message> 0

The github-code-monkey-bot workflow opened this pull request.
Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds per antagonistic review round; after that a maintainer, or the next antagonistic review, takes on any finding that remains, and a maintainer reviews every round before merge.

Round 1 of revision, on its base.


Fixes #377. Every manual dispatch of fuzz-sarif-publish.yaml failed before fuzzing any repository: the dispatch input fuzz_seconds reached the call to fuzz-sarif-repository.yaml as a string, and that workflow's number input refused it (Unexpected value '300').

What this does

  • A new secret-free Check dispatch inputs job (check-inputs, permissions: {}) checks fuzz_seconds and refuses by name any value that is not a positive whole number. Every repository job needs it.
  • Only a scheduled run, which has no inputs, takes the default 300 (github.event_name == 'schedule' && 300 || inputs.fuzz_seconds). So a dispatched 0 or empty value reaches the check and gets refused.
  • The check passes the value on as a job output. The repository call converts it with fromJSON(needs.check-inputs.outputs.fuzz_seconds), so the call gets a number and it is the same value that was checked.
  • notify-failure now needs check-inputs, so Slack still gets an alert when a scheduled run's check fails or is cancelled.
  • dry_run is unchanged; it passed without complaint.
  • Tests in test_fuzz_workflow.py pin the conversion, the schedule-only default (no inputs.fuzz_seconds || anywhere), both job dependencies and the output. They also run the check's script against good and bad values, including 0 and empty. The README documents the rule.

This round

Copilot review round 1 had two findings, both fixed:

  • The || 300 fallback replaced a dispatched 0 or empty value with 300 before the check, so the bad value got through. The default now applies only to scheduled runs.
  • notify-failure could not see a failed check-inputs. It now needs that job.

Checks run

uv run pytest (265 passed, 1 skipped). I also checked that the updated fuzz tests fail against the previous workflow. prek run --files on the changed files passed (actionlint, yamllint, ruff, mypy, basedpyright, markdownlint, reuse). Also run: zizmor --persona auditor (no findings), the aislop gate (clean) and gitlint.

For the reviewer

This session cannot dispatch workflows. After merge, please run a dry_run dispatch on grype-scan-action and confirm it reaches the per-repository jobs. Also try a dispatch with fuzz_seconds: 0 and confirm Check dispatch inputs refuses it by name.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Dispatch input normalization incorrectly accepts zero or empty values, and scheduled input-check failures can leave missed fuzz runs without Slack alerts.

2 open issues
What changed in this PR

Addresses #377 by converting manual-dispatch fuzz durations to numbers before the organisation-wide SARIF publisher invokes per-repository workflows.

Changes:

  • Explicitly converts fuzz_seconds while retaining the scheduled default.
  • Adds an input-validation job that gates repository fuzzing.
  • Adds regression tests and documents accepted duration values.
File Description
README.md Documents positive whole-number durations and the validation job.
.github/​workflows/​fuzz-sarif-publish.yaml Adds validation, a job dependency, and numeric conversion.
.github/​scripts/​tests/​test_fuzz_workflow.py Tests conversion, validation boundaries, permissions, and job structure.

Review effort: Balanced

Every manual dispatch of the fuzz publisher failed before any
repository was fuzzed: the workflow_dispatch input fuzz_seconds reaches
the call to fuzz-sarif-repository.yaml as a string, and that
workflow's number input refuses it with "Unexpected value '300'".

A new secret-free 'Check dispatch inputs' job, which every repository
job needs, refuses by name any value that is not a positive whole
number, so a bad dispatch fails clearly instead of at input expansion.
It hands the checked value over as a job output, and the repository
call converts it with fromJSON, so the call gets a number and the very
value that was checked.

Review round 1 (Copilot):
- A '|| 300' fallback replaced a dispatched 0 or empty value with 300
  before the check, so it was accepted. Only a scheduled run, which
  has no inputs, now takes the default; the check sees every
  dispatched value as given.
- notify-failure now needs check-inputs, so a scheduled run whose
  check fails or is cancelled, skipping every repository, still
  alerts Slack.

The tests pin the conversion, the scheduled-only default and both job
dependencies, and run the check's script against good and bad values,
including 0 and empty. They land with the fix: this suite imports
nothing from pytest so the pre-commit type checkers resolve it, which
rules out a strict xfail marker.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Local checks cannot exercise GitHub Actions’ server-side input coercion, and a maintainer dry-run is still needed to confirm per-repository jobs start and fuzz_seconds: 0 is rejected.

No open issues 🎉

Review effort: Balanced

@zxiiro zxiiro 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.

🤖 Auto-approved by agent: reviewed workflow/code change for security and CI/CD impact, found low risk. Adds a permissions-empty check-inputs job that validates fuzz_seconds as a positive integer via an env var (not shell interpolation) and passes it to the reusable workflow with fromJSON. Harden-runner pins unchanged; no new secrets or widened permissions.

@ModeSevenIndustrialSolutions
ModeSevenIndustrialSolutions merged commit eb1180a into lfreleng-actions:main Nov 22, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix(fuzz): Convert fuzz_seconds to a number

3 participants