Merge pull request #21211 from smowton/smowton/fix/long-actions-expressions

Actions: tolerate long `${{ ... }}` expressions
This commit is contained in:
Chris Smowton
2026-01-23 07:54:59 -08:00
committed by GitHub
21 changed files with 1014 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
---
category: fix
---
* Fixed a crash when analysing a `${{ ... }}` expression over around 300 characters in length.

View File

@@ -27,8 +27,8 @@ string getADelimitedExpression(YamlString s, int offset) {
// not just the last (greedy match) or first (reluctant match).
result =
s.getValue()
.regexpFind("\\$\\{\\{(?:[^}]|}(?!}))*\\}\\}", _, offset)
.regexpCapture("(\\$\\{\\{(?:[^}]|}(?!}))*\\}\\})", 1)
.regexpFind("\\$\\{\\{(?:[^}]|}(?!}))*+\\}\\}", _, offset)
.regexpCapture("(\\$\\{\\{(?:[^}]|}(?!}))*+\\}\\})", 1)
.trim()
}

View File

@@ -0,0 +1,5 @@
import codeql.actions.ast.internal.Ast
int getAnExpressionLength() { result = any(ExpressionImpl e).toString().length() }
select max(getAnExpressionLength())