From e34835f71a8fd247afc4ea95d5f8d55785bf6cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Mu=C3=B1oz?= Date: Mon, 28 Oct 2024 11:55:23 +0100 Subject: [PATCH] fix: AstNode.getATriggerEvent() getATriggerEvent did not work for nodes outside a Job. If there is no enclosing job, get the trigger from the enclosing workflow --- ql/lib/codeql/actions/ast/internal/Ast.qll | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ql/lib/codeql/actions/ast/internal/Ast.qll b/ql/lib/codeql/actions/ast/internal/Ast.qll index ce6db22636c..5f33400bb96 100644 --- a/ql/lib/codeql/actions/ast/internal/Ast.qll +++ b/ql/lib/codeql/actions/ast/internal/Ast.qll @@ -114,7 +114,11 @@ abstract class AstNodeImpl extends TAstNode { /** * Gets and Event triggering this node. */ - EventImpl getATriggerEvent() { result = this.getEnclosingJob().getATriggerEvent() } + EventImpl getATriggerEvent() { + result = this.getEnclosingJob().getATriggerEvent() + or + not exists(this.getEnclosingJob()) and result = this.getEnclosingWorkflow().getATriggerEvent() + } /** * Gets the enclosing Step.