Skip to content

Conversation

@owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Nov 28, 2025

Fixes https://github.com/github/codeql-team/issues/4370 . Includes a test demonstrating this.

In general I think the filtering between different severity levels for many queries should probably be modified to be more like this, so that it's clearer that we aren't letting some alerts fall between the cracks.

This is based on push.yml, and it should still be found by
actions/code-injection/medium, but it isn't.
Copilot AI review requested due to automatic review settings November 28, 2025 23:25
@owen-mc owen-mc requested a review from a team as a code owner November 28, 2025 23:25
@github-actions github-actions bot added documentation Actions Analysis of GitHub Actions labels Nov 28, 2025
Copilot finished reviewing on behalf of owen-mc November 28, 2025 23:27
Copy link
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 fixes a filtering gap in code injection queries where alerts could be missed when neither the medium nor critical severity query would report them.

  • Introduces a new helper predicate getRelevantCriticalEventForSourceSink that checks both sink context and source event matching
  • Updates the medium query to explicitly exclude critical query results rather than using complementary context checks
  • Adds test case demonstrating the fix with a workflow triggered by both push and workflow_dispatch events

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
actions/ql/lib/codeql/actions/security/CodeInjectionQuery.qll Adds new predicate combining sink context and source event checks
actions/ql/src/Security/CWE-094/CodeInjectionCritical.ql Simplifies query to use new combined predicate
actions/ql/src/Security/CWE-094/CodeInjectionMedium.ql Changes to explicitly exclude critical results using new predicate
actions/ql/test/query-tests/Security/CWE-094/.github/workflows/push_and_workflow_dispatch.yml New test case demonstrating the filtering fix
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionMedium.expected Updated expected test results
actions/ql/test/query-tests/Security/CWE-094/CodeInjectionCritical.expected Updated expected test results
actions/ql/lib/change-notes/2025-11-28-fix-code-injection-alert-filtering.md Documents the majorAnalysis change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@owen-mc owen-mc force-pushed the actions/fix/code-injection-privileged-context branch from 6f75eb7 to 6d3ee98 Compare November 29, 2025 01:06
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.

1 participant