Skip to content

Commit 5fb41e4

Browse files
committed
Inline Expectation Tests: Disallow tag[[[foo bar]
1 parent 50196d0 commit 5fb41e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

python/ql/test/TestUtilities/InlineExpectationsTest.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,21 @@ private string getColumnString(TColumn column) {
242242
* more comma-separated tags optionally followed by `=` and the expected value.
243243
*
244244
* Tags must be only letters, digits, `-` and `_` (note that the first character
245-
* must not be a digit), but can contain anything enclosed in a square brackets.
245+
* must not be a digit), but can contain anything enclosed in a single set of
246+
* square brackets.
246247
*
247248
* Examples:
248249
* - `tag`
249250
* - `tag=value`
250251
* - `tag,tag2=value`
251252
* - `tag[foo bar]=value`
253+
*
254+
* Not allowed:
255+
* - `tag[[[foo bar]`
252256
*/
253257
private string expectationPattern() {
254258
exists(string tag, string tags, string value |
255-
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]]*\\])*" and
259+
tag = "[A-Za-z-_](?:[A-Za-z-_0-9]|\\[[^\\]\\]]*\\])*" and
256260
tags = "((?:" + tag + ")(?:\\s*,\\s*" + tag + ")*)" and
257261
// In Python, we allow both `"` and `'` for strings, as well as the prefixes `bru`.
258262
// For example, `b"foo"`.

0 commit comments

Comments
 (0)