Skip to content

Actions: Add workflow_dispatch and workflow_call input sources for code injection#21660

Open
tspascoal wants to merge 4 commits intogithub:mainfrom
tspascoal:improve-actions-code-injection-queries
Open

Actions: Add workflow_dispatch and workflow_call input sources for code injection#21660
tspascoal wants to merge 4 commits intogithub:mainfrom
tspascoal:improve-actions-code-injection-queries

Conversation

@tspascoal
Copy link
Copy Markdown
Contributor

This pull request introduces improved detection and severity classification of code injection vulnerabilities in GitHub Actions workflows.

Adds workflow_dispatch string inputs as a source for actions/code-injection/medium

Adds a new actions/code-injection/low for workflow_call string inputs, decided to use this as low since we can't see the full source for a final analysis if the input is user defined or not.

The actions/code-injection/low was explicitily added to the security-extended suite since it doesn't fit the criteria to be automatically added.

To evaluate: does it make sense to have actions/code-injection/low or remove it and add workfow_call to actions/code-injection/medium?

Note

Have not updated any changelog

Detection and modeling of workflow inputs:

  • Added new data flow sources: WorkflowDispatchInputSource (for workflow_dispatch string inputs, including those with no explicit type) and WorkflowCallInputSource (for workflow_call string inputs), both treated as untrusted in code injection analysis.
  • Updated the dataflow and security query logic to classify workflow_call string inputs as low severity and workflow_dispatch string inputs as medium severity code injection risks. [1] [2]

Query and documentation updates:

  • Added a new query CodeInjectionLow.ql and corresponding documentation to detect and explain code injection via workflow_call string inputs, including recommendations and examples. [1] [2]
  • Improved the documentation for medium-severity code injection to clarify the risk of workflow_dispatch string inputs and to provide better examples and safe usage patterns. [1] [2] [3]

Test and suite changes:

  • Added and updated test workflows and expected outputs to cover workflow_call and workflow_dispatch input handling and to verify detection of both vulnerable and safe usage patterns. [1] [2] [3] [4] [5]
  • Modified the actions-security-extended.qls suite to explicitly include the new low-precision CodeInjectionLow.ql query.

…de injection

Model workflow_dispatch string inputs and workflow_call string inputs as
remote flow sources. Add a new low-severity CodeInjection query for
workflow_call inputs.

The low severity CodeInjection query is explicitily added to the security-extended suite
@tspascoal tspascoal requested a review from a team as a code owner April 6, 2026 20:44
Copilot AI review requested due to automatic review settings April 6, 2026 20:44
@github-actions github-actions bot added documentation Actions Analysis of GitHub Actions labels Apr 6, 2026
@@ -0,0 +1 @@
Security/CWE-094/CodeInjectionLow.ql
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Actions code injection analysis to treat workflow_dispatch string inputs as medium-severity sources and introduces a new low-severity query for workflow_call string inputs (with corresponding docs, tests, and suite wiring).

Changes:

  • Added new workflow input sources for workflow_dispatch (string/untyped) and workflow_call (string) to the taint/source modeling used by code injection analysis.
  • Split reporting so workflow_call input flows are reported as a new low-severity query (actions/code-injection/low), while workflow_dispatch inputs are handled by the existing medium-severity query.
  • Updated documentation, query tests, and explicitly included the low-precision query in the actions-security-extended suite.
Show a summary per file
File Description
actions/ql/lib/codeql/actions/dataflow/FlowSources.qll Adds dataflow sources for workflow_dispatch and workflow_call inputs.
actions/ql/lib/codeql/actions/security/CodeInjectionQuery.qll Adjusts severity classification logic and introduces a low-severity predicate for workflow_call.
actions/ql/src/Security/CWE-094/CodeInjectionLow.ql New low-severity code injection query entrypoint.
actions/ql/src/Security/CWE-094/CodeInjectionLow.md New documentation for the low-severity reusable-workflow input variant.
actions/ql/src/Security/CWE-094/CodeInjectionMedium.md Documentation updates covering workflow_dispatch string/untyped inputs.
actions/ql/src/codeql-suites/actions-security-extended.qls Explicitly includes the new low-precision query in security-extended.
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionLow.qlref Adds a query test reference for the new low-severity query.
actions/ql/test/query-tests/Security/CWE-094/.github/workflows/workflow_call.yml Adds a reusable-workflow test case for workflow_call inputs.
actions/ql/test/query-tests/Security/CWE-094/.github/workflows/workflow_dispatch.yml Adds a test case for workflow_dispatch inputs (typed/untyped) and safe patterns.
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionLow.expected New expected results for the low-severity query test.
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionMedium.expected Updates expected results to include workflow_dispatch input flows.
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionCritical.expected Updates expected results (node graph changes due to new sources).
actions/ql/test/query-tests/Models/ReusableWorkflowsSources.expected Updates reusable workflow source modeling test expectations.

Copilot's findings

  • Files reviewed: 12/13 changed files
  • Comments generated: 4

Comment on lines +1 to +6
## Overview

Using string-typed `workflow_call` inputs in GitHub Actions may lead to code injection in contexts like _run:_ or _script:_.

Inputs declared as `string` should be treated with caution. Although `workflow_call` can only be triggered by other workflows (not directly by external users), the calling workflow may pass untrusted user input as arguments. Since the reusable workflow author has no control over the callers, these inputs may still originate from untrusted data.

Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

This PR adds a new query (actions/code-injection/low) and changes the results/metadata of code injection analysis; per the repository’s change-notes guidance, this should come with an unreleased change note under actions/ql/src/change-notes/ (for example with category newQuery / minorAnalysis).

Copilot uses AI. Check for mistakes.
Treat workflow_call and workflow_dispatch inputs independently for
code-injection severity classification so mixed-trigger workflows can
produce both low and medium alerts.

Add a regression test for workflows that define both triggers and update
the corresponding expected results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Actions Analysis of GitHub Actions documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants