Repository navigation
[actions-aw-linter] Fix artifact execution detection for option-prefixed scripts - #73832
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Request changes
The new operand scan still produces false negatives for option arguments that consume a separate word, such as bash -o pipefail incoming/run.sh and python3 -W ignore incoming/run.py. The added tests cover only valueless flags, so this gap is not protected.
Details
Make operand detection aware of value-taking interpreter options, and add regression coverage for those forms before merging.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs — the fix correctly handles simple option-prefixed invocations (bash -e script.sh, python3 -u script.py), but misses the case where a flag itself takes a value (e.g. bash -o pipefail incoming/run.sh). The new operand scanner skips any token starting with - but has no concept of flags that consume a following argument, so that argument gets mistaken for the script path and the real sink is missed — a regression of the same false-negative class this PR sets out to fix, just one flag-shape further.
Requesting changes on test coverage / root-cause completeness before merge; left one inline comment with a concrete repro and suggested fix.
📋 Key Themes
- Root cause only partially addressed: the fix generalizes "skip option flags" to a loop, but doesn't account for flags with values, which is a very common CLI pattern (
-o,-c,--log-file foo). This is squarely a/diagnosing-bugsregression-test gap — the new tests (bash -e ...,python3 -u ...) only cover flags with no value, so the incomplete fix passes CI. - Scope checked: verified
npx/makewith a bare flag (npx -y) still behaves correctly (no false positive), so the regression is isolated to the value-consuming-flag case for thebash/sh/python/node/source/.branch (and the analogousnpm run <script>branch).
✅ Positive Highlights
- Clean refactor from a single fixed-index
operandto a scanning helper — good direction for the general problem. - Regression tests were added alongside the fix, which is the right instinct even though they don't yet cover the value-flag edge case.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~48 AIC · ⌖ ~19 AIC · ⊞ 10.7K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Artifact-execution detection mishandles unresolved operands and interpreter options, causing false positives and missed warnings for downloaded scripts and dynamic Make/npx commands.
3 open issues
What changed in this PR
This PR improves gh-aw’s shared Actions/AW artifact-execution lint rule to detect cross-run artifact scripts invoked with leading option flags.
Changes:
- Scan past leading flags when selecting interpreter script paths and npm/Make/npx operands.
- Add regression cases for
bash -eandpython3 -uacross both AST targets.
| File | Description |
|---|---|
pkg/workflow/lint/artifact_execution.go |
Updates operand selection for option-prefixed commands. |
pkg/workflow/lint/artifact_execution_test.go |
Adds shell and Python option-prefix regression tests. |
Review effort: Max (auto)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Summary
This patch tightens the
artifact-executionlint rule so it still flags executable cross-run artifact content when the interpreter or shell is invoked with option flags before the script path (for examplebash -e incoming/run.shorpython3 -u incoming/run.py).Why
The previous logic assumed the first non-option operand was always the script path. That missed valid command forms where flags appear before the target file, creating a false negative in workflow_run artifact execution checks.
AST targets
ActionsASTAWASTValidation
Ran successfully:
make fmt-gogo test ./pkg/workflow/lint ./pkg/workflow/actions ./pkg/workflow/aw ./pkg/workflow/taintmake build./gh-aw lint --list-rules | head -n 40Notes