Shared: allow spaces between arguments in a token

This commit is contained in:
Asger Feldthaus
2022-02-15 09:57:05 +01:00
parent 55ac5cb012
commit 2c2a82a070
4 changed files with 13 additions and 1 deletions

View File

@@ -72,7 +72,7 @@ class AccessPathToken extends string {
string getArgumentList() { result = this.getPart(2) }
/** Gets the `n`th argument to this token, such as `x` or `y` from `Member[x,y]`. */
string getArgument(int n) { result = this.getArgumentList().splitAt(",", n) }
string getArgument(int n) { result = this.getArgumentList().splitAt(",", n).trim() }
/** Gets an argument to this token, such as `x` or `y` from `Member[x,y]`. */
string getAnArgument() { result = this.getArgument(_) }

View File

@@ -28,6 +28,9 @@ taintFlow
| test.js:76:31:76:38 | source() | test.js:76:31:76:38 | source() |
| test.js:77:34:77:41 | source() | test.js:77:34:77:41 | source() |
| test.js:81:28:81:35 | source() | test.js:81:28:81:35 | source() |
| test.js:87:17:87:24 | source() | test.js:87:17:87:24 | source() |
| test.js:88:17:88:24 | source() | test.js:88:17:88:24 | source() |
| test.js:89:17:89:24 | source() | test.js:89:17:89:24 | source() |
isSink
| test.js:46:18:46:25 | source() | test-sink |
| test.js:47:22:47:29 | source() | test-sink |
@@ -71,6 +74,9 @@ isSink
| test.js:78:34:78:34 | 3 | test-sink |
| test.js:81:28:81:35 | source() | test-sink |
| test.js:82:28:82:28 | 1 | test-sink |
| test.js:87:17:87:24 | source() | test-sink |
| test.js:88:17:88:24 | source() | test-sink |
| test.js:89:17:89:24 | source() | test-sink |
syntaxErrors
| Member[foo |
| Member[foo] .Member[bar] |

View File

@@ -83,4 +83,9 @@ function testSinks() {
testlib.mySinkIfArityTwo(source(), 2, 3); // OK
testlib.mySinkIfArityTwo(1, source(), 3); // OK
testlib.mySinkIfArityTwo(1, 2, source()); // OK
testlib.sink1(source()); // NOT OK
testlib.sink2(source()); // NOT OK
testlib.sink3(source()); // NOT OK
testlib.sink4(source()); // OK
}

View File

@@ -30,6 +30,7 @@ class Sinks extends ModelInput::SinkModelCsv {
"testlib;;Member[mySinkTwoLastRange].Argument[N-2..N-1];test-sink",
"testlib;;Member[mySinkExceptLast].Argument[0..N-2];test-sink",
"testlib;;Member[mySinkIfArityTwo].WithArity[2].Argument[0];test-sink",
"testlib;;Member[sink1, sink2, sink3 ].Argument[0];test-sink",
]
}
}