Skip to content

Commit 2c2a82a

Browse files
committed
Shared: allow spaces between arguments in a token
1 parent 55ac5cb commit 2c2a82a

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class AccessPathToken extends string {
7272
string getArgumentList() { result = this.getPart(2) }
7373

7474
/** Gets the `n`th argument to this token, such as `x` or `y` from `Member[x,y]`. */
75-
string getArgument(int n) { result = this.getArgumentList().splitAt(",", n) }
75+
string getArgument(int n) { result = this.getArgumentList().splitAt(",", n).trim() }
7676

7777
/** Gets an argument to this token, such as `x` or `y` from `Member[x,y]`. */
7878
string getAnArgument() { result = this.getArgument(_) }

javascript/ql/test/library-tests/frameworks/data/test.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ taintFlow
2828
| test.js:76:31:76:38 | source() | test.js:76:31:76:38 | source() |
2929
| test.js:77:34:77:41 | source() | test.js:77:34:77:41 | source() |
3030
| test.js:81:28:81:35 | source() | test.js:81:28:81:35 | source() |
31+
| test.js:87:17:87:24 | source() | test.js:87:17:87:24 | source() |
32+
| test.js:88:17:88:24 | source() | test.js:88:17:88:24 | source() |
33+
| test.js:89:17:89:24 | source() | test.js:89:17:89:24 | source() |
3134
isSink
3235
| test.js:46:18:46:25 | source() | test-sink |
3336
| test.js:47:22:47:29 | source() | test-sink |
@@ -71,6 +74,9 @@ isSink
7174
| test.js:78:34:78:34 | 3 | test-sink |
7275
| test.js:81:28:81:35 | source() | test-sink |
7376
| test.js:82:28:82:28 | 1 | test-sink |
77+
| test.js:87:17:87:24 | source() | test-sink |
78+
| test.js:88:17:88:24 | source() | test-sink |
79+
| test.js:89:17:89:24 | source() | test-sink |
7480
syntaxErrors
7581
| Member[foo |
7682
| Member[foo] .Member[bar] |

javascript/ql/test/library-tests/frameworks/data/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,9 @@ function testSinks() {
8383
testlib.mySinkIfArityTwo(source(), 2, 3); // OK
8484
testlib.mySinkIfArityTwo(1, source(), 3); // OK
8585
testlib.mySinkIfArityTwo(1, 2, source()); // OK
86+
87+
testlib.sink1(source()); // NOT OK
88+
testlib.sink2(source()); // NOT OK
89+
testlib.sink3(source()); // NOT OK
90+
testlib.sink4(source()); // OK
8691
}

javascript/ql/test/library-tests/frameworks/data/test.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Sinks extends ModelInput::SinkModelCsv {
3030
"testlib;;Member[mySinkTwoLastRange].Argument[N-2..N-1];test-sink",
3131
"testlib;;Member[mySinkExceptLast].Argument[0..N-2];test-sink",
3232
"testlib;;Member[mySinkIfArityTwo].WithArity[2].Argument[0];test-sink",
33+
"testlib;;Member[sink1, sink2, sink3 ].Argument[0];test-sink",
3334
]
3435
}
3536
}

0 commit comments

Comments
 (0)