Skip to content

[actions-aw-linter] Fix artifact execution detection for option-prefixed scripts - #73832

Merged
pelikhan merged 3 commits into
mainfrom
fix-artifact-option-operand-5d61d8be2ff01c90
Nov 1, 2026
Merged

pelikhan merged 3 commits into
mainfrom
fix-artifact-option-operand-5d61d8be2ff01c90

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

This patch tightens the artifact-execution lint 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 example bash -e incoming/run.sh or python3 -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

  • ActionsAST
  • AWAST

Validation

Ran successfully:

  • make fmt-go
  • go test ./pkg/workflow/lint ./pkg/workflow/actions ./pkg/workflow/aw ./pkg/workflow/taint
  • make build
  • ./gh-aw lint --list-rules | head -n 40

Notes

  • Added a focused regression test covering option-prefixed shell/Python invocations.
  • No unrelated workflow or generated file changes were made.

Generated by Actions and AW Linter Factory · copilot · mai11 · ~5 AIC · ⌖ ~1 AIC · ⊞ 16.2K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 1, 2026 17:50
Copilot AI dynamic review requested due to automatic review settings November 1, 2026 17:50
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · gpt56 · ~8 AIC · ⌖ ~6 AIC · ⊞ 15.1K · ◷

Generated by Ponytail Reviewer for #73832

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · routed: gpt56 max · ~1 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · sonnet50 · ~15 AIC · ⌖ ~19 AIC · ◇ ~8 AIC · ⊞ 12.7K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-01T17:53:08Z
review_event: REQUEST_CHANGES
top_themes:
  - option parsing misses value-taking interpreter flags
  - regression coverage only covers valueless flags
files_reviewed:
  - pkg/workflow/lint/artifact_execution.go
  - pkg/workflow/lint/artifact_execution_test.go
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread pkg/workflow/lint/artifact_execution.go Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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-bugs regression-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/make with a bare flag (npx -y) still behaves correctly (no false positive), so the regression is isolated to the value-consuming-flag case for the bash/sh/python/node/source/. branch (and the analogous npm run <script> branch).
✅ Positive Highlights
  • Clean refactor from a single fixed-index operand to 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

Comment thread pkg/workflow/lint/artifact_execution.go Resolved

Copilot AI 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.

🟡 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 -e and python3 -u across 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)

Comment thread pkg/workflow/lint/artifact_execution.go Resolved
Comment thread pkg/workflow/lint/artifact_execution.go Resolved
Comment thread pkg/workflow/lint/artifact_execution.go Resolved
pelikhan and others added 2 commits November 1, 2026 10:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit 1917f59 into main Nov 1, 2026
53 checks passed
@pelikhan
pelikhan deleted the fix-artifact-option-operand-5d61d8be2ff01c90 branch November 1, 2026 18:26
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants