@@ -74,9 +74,10 @@ predicate extractVariableAndValue(string raw_content, string key, string value)
74
74
bindingset [ script]
75
75
predicate singleLineFileWrite ( string script , string cmd , string file , string content , string filters ) {
76
76
exists ( string regexp |
77
- regexp = "(?i)(echo|printf|write-output)\\s*(.*?)\\s*(>>|>)\\s*(\\S+)" and
77
+ regexp =
78
+ "(?i)(echo|printf|write-output)\\s*(.*?)\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+)" and
78
79
cmd = script .regexpCapture ( regexp , 1 ) and
79
- file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
80
+ file = trimQuotes ( script .regexpCapture ( regexp , 5 ) ) and
80
81
filters = "" and
81
82
content = script .regexpCapture ( regexp , 2 )
82
83
)
@@ -100,18 +101,19 @@ predicate singleLineWorkflowCmd(string script, string cmd, string key, string va
100
101
bindingset [ script]
101
102
predicate heredocFileWrite ( string script , string cmd , string file , string content , string filters ) {
102
103
exists ( string regexp |
103
- regexp = "(?msi).*^(cat)\\s*(>>|>)\\s*(\\S+)\\s*<<\\s*['\"]?(\\S+)['\"]?\\s*\n(.*?)\n\\4\\s*$.*" and
104
+ regexp =
105
+ "(?msi).*^(cat)\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)?)\\s*(\\S+)\\s*<<\\s*['\"]?(\\S+)['\"]?\\s*\n(.*?)\n\\4\\s*$.*" and
104
106
cmd = script .regexpCapture ( regexp , 1 ) and
105
- file = trimQuotes ( script .regexpCapture ( regexp , 3 ) ) and
106
- content = script .regexpCapture ( regexp , 5 ) and
107
+ file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
108
+ content = script .regexpCapture ( regexp , 6 ) and
107
109
filters = ""
108
110
or
109
111
regexp =
110
- "(?msi).*^(cat)\\s*(<<|<)\\s*[-]?['\"]?(\\S+)['\"]?\\s*([^>]*)(>>|>)\\s*(\\S+)\\s*\n(.*?)\n\\3\\s*$.*" and
112
+ "(?msi).*^(cat)\\s*(<<|<)\\s*[-]?['\"]?(\\S+)['\"]?\\s*([^>]*)(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)? )\\s*(\\S+)\\s*\n(.*?)\n\\3\\s*$.*" and
111
113
cmd = script .regexpCapture ( regexp , 1 ) and
112
- file = trimQuotes ( script .regexpCapture ( regexp , 6 ) ) and
114
+ file = trimQuotes ( script .regexpCapture ( regexp , 7 ) ) and
113
115
filters = script .regexpCapture ( regexp , 4 ) and
114
- content = script .regexpCapture ( regexp , 7 )
116
+ content = script .regexpCapture ( regexp , 8 )
115
117
)
116
118
}
117
119
@@ -142,13 +144,13 @@ predicate blockFileWrite(string script, string cmd, string file, string content,
142
144
//
143
145
"(.*?)" +
144
146
//
145
- "(\\s*\\}\\s*(>>|>)\\s*(\\S+))\\s*$.*" and
147
+ "(\\s*\\}\\s*(>>|>|\\s*\\|\\s*tee\\s*(-a|--append)? )\\s*(\\S+))\\s*$.*" and
146
148
content =
147
149
script
148
150
.regexpCapture ( regexp , 1 )
149
151
.regexpReplaceAll ( "(?m)^\\s*(echo|printf|write-output)\\s*['\"](.*?)['\"]" , "$2" )
150
152
.regexpReplaceAll ( "(?m)^\\s*(echo|printf|write-output)\\s*" , "" ) and
151
- file = trimQuotes ( script .regexpCapture ( regexp , 4 ) ) and
153
+ file = trimQuotes ( script .regexpCapture ( regexp , 5 ) ) and
152
154
cmd = "echo" and
153
155
filters = ""
154
156
)
0 commit comments