@@ -74,7 +74,7 @@ predicate extractVariableAndValue(string raw_content, string key, string value)
7474bindingset [ script]
7575predicate singleLineFileWrite ( string script , string cmd , string file , string content , string filters ) {
7676 exists ( string regexp |
77- regexp = "(?i)(echo|write-output)\\s*(.*?)\\s*(>>|>)\\s*(\\S+)" and
77+ regexp = "(?i)(echo|printf| write-output)\\s*(.*?)\\s*(>>|>)\\s*(\\S+)" and
7878 cmd = script .regexpCapture ( regexp , 1 ) and
7979 file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
8080 filters = "" and
@@ -85,12 +85,12 @@ predicate singleLineFileWrite(string script, string cmd, string file, string con
8585bindingset [ script]
8686predicate singleLineWorkflowCmd ( string script , string cmd , string key , string value ) {
8787 exists ( string regexp |
88- regexp = "(?i)(echo|write-output)\\s*(['|\"])?::(set-[a-z]+)\\s*name\\s*=\\s*(.*?)::(.*)" and
88+ regexp = "(?i)(echo|printf| write-output)\\s*(['|\"])?::(set-[a-z]+)\\s*name\\s*=\\s*(.*?)::(.*)" and
8989 cmd = script .regexpCapture ( regexp , 3 ) and
9090 key = script .regexpCapture ( regexp , 4 ) and
9191 value = trimQuotes ( script .regexpCapture ( regexp , 5 ) )
9292 or
93- regexp = "(?i)(echo|write-output)\\s*(['|\"])?::(add-[a-z]+)\\s*::(.*)" and
93+ regexp = "(?i)(echo|printf| write-output)\\s*(['|\"])?::(add-[a-z]+)\\s*::(.*)" and
9494 cmd = script .regexpCapture ( regexp , 3 ) and
9595 key = "" and
9696 value = trimQuotes ( script .regexpCapture ( regexp , 4 ) )
@@ -119,17 +119,17 @@ bindingset[script]
119119predicate linesFileWrite ( string script , string cmd , string file , string content , string filters ) {
120120 exists ( string regexp |
121121 regexp =
122- "(?msi).*(echo\\s+['|\"]?(.*?<<(\\S+))['|\"]?\\s*>>\\s*(\\S+)\\s*[\r\n]+)" +
122+ "(?msi).*(( echo|printf) \\s+['|\"]?(.*?<<(\\S+))['|\"]?\\s*>>\\s*(\\S+)\\s*[\r\n]+)" +
123123 "(((.*?)\\s*>>\\s*\\S+\\s*[\r\n]+)+)" +
124- "(echo\\s+['|\"]?(EOF)['|\"]?\\s*>>\\s*\\S+\\s*[\r\n]*).*" and
124+ "(( echo|printf) \\s+['|\"]?(EOF)['|\"]?\\s*>>\\s*\\S+\\s*[\r\n]*).*" and
125125 content =
126- trimQuotes ( script .regexpCapture ( regexp , 2 ) ) + "\n" + "$(" +
127- trimQuotes ( script .regexpCapture ( regexp , 5 ) ) +
126+ trimQuotes ( script .regexpCapture ( regexp , 3 ) ) + "\n" + "$(" +
127+ trimQuotes ( script .regexpCapture ( regexp , 6 ) ) +
128128 // TODO: there are some >> $GITHUB_ENV, >> $GITHUB_OUTPUT, >> "$GITHUB_ENV" lefotvers in content
129129 //.regexpReplaceAll("\\s*(>|>>)\\s*\\$[{]*" + file + "(.*?)[}]*", "")
130- ")\n" + trimQuotes ( script .regexpCapture ( regexp , 3 ) ) and
130+ ")\n" + trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
131131 cmd = "echo" and
132- file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
132+ file = trimQuotes ( script .regexpCapture ( regexp , 5 ) ) and
133133 filters = ""
134134 )
135135}
@@ -146,8 +146,8 @@ predicate blockFileWrite(string script, string cmd, string file, string content,
146146 content =
147147 script
148148 .regexpCapture ( regexp , 1 )
149- .regexpReplaceAll ( "(?m)^[ ]* echo\\s*['\"](.*?)['\"]" , "$1 " )
150- .regexpReplaceAll ( "(?m)^[ ]* echo\\s*" , "" ) and
149+ .regexpReplaceAll ( "(?m)^\\s*( echo|printf|write-output) \\s*['\"](.*?)['\"]" , "$2 " )
150+ .regexpReplaceAll ( "(?m)^\\s*( echo|printf|write-output) \\s*" , "" ) and
151151 file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
152152 cmd = "echo" and
153153 filters = ""
0 commit comments