Actions: ActorIfCheck ControlCheck model fix for events that don't populate the checked field - #22368
Open
computersarebad wants to merge 1 commit into
Open
Conversation
…the checked field A condition like 'github.event.pull_request.user.login != ...' on a workflow triggered by issues events is always true since github.event.pull_request is not populated for issues events, but ActorIfCheck still treated it as a protective check, suppressing alerts such as actions/code-injection/critical. Override protectsCategoryAndEvent in ActorIfCheck so that checks on event payload fields only protect events whose payload contains the corresponding context, using contextTriggerDataModel as the mapping. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4084febb-f9c7-44df-baf3-c8be8e9932a7
Contributor
There was a problem hiding this comment.
Pull request overview
Updates ActorIfCheck to consider whether event payload actor fields exist for the triggering event.
Changes:
- Maps payload actor checks to compatible events.
- Adds valid and vacuous actor-check fixtures.
- Updates expected query results and release notes.
Show a summary per file
| File | Description |
|---|---|
ControlChecks.qll |
Adds event-aware actor-check protection logic. |
actor_check_wrong_event.yml |
Tests a vacuous payload check and valid global actor check. |
actor_check_valid_event.yml |
Tests a valid pull-request payload check. |
CodeInjectionMedium.expected |
Updates generated medium-query results. |
CodeInjectionCritical.expected |
Updates generated critical-query results. |
2026-08-17-actor-if-check-event-validity.md |
Documents the analysis change. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22367
Currently
ActorIfChecktreats a condition as an actor check if it mentions a field likegithub.event.pull_request.user.loginanywhere in theif:expression, and the check then counts as protection for all the events ActorCheck covers. It never looks at whether that field is even populated for the event triggering the workflow. On anissueseventgithub.event.pull_requestis null, so something likeif: github.event.pull_request.user.login != 'some-bot[bot]'is always true and gates nothing, but it still suppressedactions/code-injection/critical(repro in the linked issue).This change overrides
protectsCategoryAndEventin ActorIfCheck so payload field checks only protect events whose payload actually contains that context, reusing the existingcontextTriggerDataModelextension for the mapping. Checks ongithub.actor,github.triggering_actorandgithub.event.sender.loginstill protect every event since those are always populated. The characteristic predicate is unchanged, including the%[bot]%exclusion.This is the same kind of fix as #22154 did for EnvironmentCheck, which suggested reviewing if other check types have this issue. Added two testcases:
actor_check_wrong_event.ymlwith the vacuous check (now detected as critical) next to a validgithub.actorcheck (still medium), andactor_check_valid_event.ymlwith agithub.event.pull_request.user.logincheck on apull_request_targetevent, which is populated there and still suppresses the critical alert. No existing test results change.