From cc3f2eed68329d37539675aa3a15c3798495feb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Mu=C3=B1oz?= Date: Tue, 13 Feb 2024 11:24:16 +0100 Subject: [PATCH] add characteristic predicates to InputExpr and OutputExpr --- ql/lib/codeql/actions/Ast.qll | 10 ++++++---- ql/lib/codeql/actions/controlflow/internal/Cfg.qll | 6 +----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ql/lib/codeql/actions/Ast.qll b/ql/lib/codeql/actions/Ast.qll index 0685b2fc14d..c7573dfb839 100644 --- a/ql/lib/codeql/actions/Ast.qll +++ b/ql/lib/codeql/actions/Ast.qll @@ -96,11 +96,13 @@ class OutputsStmt extends Statement instanceof YamlMapping { } } -// TODO: Needs a characteristic predicate otherwise anything is an output expression -class InputExpr extends Expression instanceof YamlString { } +class InputExpr extends Expression instanceof YamlString { + InputExpr() { exists(InputsStmt inputs | inputs.(YamlMapping).maps(this, _)) } +} -// TODO: Needs a characteristic predicate otherwise anything is an output expression -class OutputExpr extends Expression instanceof YamlString { } +class OutputExpr extends Expression instanceof YamlString { + OutputExpr() { exists(OutputsStmt outputs | outputs.(YamlMapping).maps(_, this)) } +} /** * A Job is a collection of steps that run in an execution environment. diff --git a/ql/lib/codeql/actions/controlflow/internal/Cfg.qll b/ql/lib/codeql/actions/controlflow/internal/Cfg.qll index bb0c25dbdf6..8d044c827a2 100644 --- a/ql/lib/codeql/actions/controlflow/internal/Cfg.qll +++ b/ql/lib/codeql/actions/controlflow/internal/Cfg.qll @@ -35,11 +35,7 @@ module Completion { override string toString() { result = "BooleanCompletion(" + value + ")" } - override predicate isValidForSpecific(AstNode e) { - none() - // TODO: add support for conditional expressions? - //e = any(ConditionalExpression c).getCondition() - } + override predicate isValidForSpecific(AstNode e) { none() } override BooleanSuccessor getAMatchingSuccessorType() { result.getValue() = value }