Repository navigation
Fix(fuzz): Convert fuzz_seconds to a number - #378
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
There was a problem hiding this comment.
🟡 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_secondswhile 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>
38da313 to
1517f93
Compare
zxiiro
left a comment
There was a problem hiding this comment.
🤖 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.
eb1180a
into
lfreleng-actions:main

Closes #377
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI805caa29f7475dcaae3aca673d3e695f4a7fcbefuv run pytest -q .github/scripts/tests/test_fuzz_workflow.pyuv run pytest -q .github/scripts/tests/test_fuzz_workflow.py (against the previous workflow, expected to fail)uv run pytest -qprek run --files .github/scripts/tests/test_fuzz_workflow.py .github/workflows/fuzz-sarif-publish.yaml README.mduvx zizmor --offline --persona auditor .github/workflows/fuzz-sarif-publish.yamlbash scripts/agents/aislop-gate.sh 805caa29f7475dcaae3aca673d3e695f4a7fcbefuv run --with ruff bash scripts/agents/aislop-gate.sh 805caa29f7475dcaae3aca673d3e695f4a7fcbefprek run gitlint --hook-stage commit-msg --commit-msg-filename <commit message>The
github-code-monkey-botworkflow 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.yamlfailed before fuzzing any repository: the dispatch inputfuzz_secondsreached the call tofuzz-sarif-repository.yamlas a string, and that workflow'snumberinput refused it (Unexpected value '300').What this does
check-inputs,permissions: {}) checksfuzz_secondsand refuses by name any value that is not a positive whole number. Every repository job needs it.github.event_name == 'schedule' && 300 || inputs.fuzz_seconds). So a dispatched0or empty value reaches the check and gets refused.fromJSON(needs.check-inputs.outputs.fuzz_seconds), so the call gets a number and it is the same value that was checked.notify-failurenow needscheck-inputs, so Slack still gets an alert when a scheduled run's check fails or is cancelled.dry_runis unchanged; it passed without complaint.test_fuzz_workflow.pypin the conversion, the schedule-only default (noinputs.fuzz_seconds ||anywhere), both job dependencies and the output. They also run the check's script against good and bad values, including0and empty. The README documents the rule.This round
Copilot review round 1 had two findings, both fixed:
|| 300fallback replaced a dispatched0or empty value with 300 before the check, so the bad value got through. The default now applies only to scheduled runs.notify-failurecould not see a failedcheck-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 --fileson 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_rundispatch ongrype-scan-actionand confirm it reaches the per-repository jobs. Also try a dispatch withfuzz_seconds: 0and confirm Check dispatch inputs refuses it by name.