Skip to content

Commit afc2d3e

Browse files
committed
JS: Add: String.protytpe.toWellFormed to StringManipulationTaintStep
1 parent 09f73d8 commit afc2d3e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ module TaintTracking {
612612
"italics", "link", "padEnd", "padStart", "repeat", "replace", "replaceAll", "slice",
613613
"small", "split", "strike", "sub", "substr", "substring", "sup",
614614
"toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase", "toUpperCase", "trim",
615-
"trimLeft", "trimRight"
615+
"trimLeft", "trimRight", "toWellFormed"
616616
]
617617
or
618618
// sorted, interesting, properties of Object.prototype

javascript/ql/test/library-tests/TaintTracking/BasicTaintTracking.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ typeInferenceMismatch
209209
| static-capture-groups.js:2:17:2:24 | source() | static-capture-groups.js:27:14:27:22 | RegExp.$1 |
210210
| static-capture-groups.js:32:17:32:24 | source() | static-capture-groups.js:38:10:38:18 | RegExp.$1 |
211211
| static-capture-groups.js:42:12:42:19 | source() | static-capture-groups.js:43:14:43:22 | RegExp.$1 |
212+
| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:3:10:3:25 | x.toWellFormed() |
213+
| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:6:10:6:20 | wellFormedX |
214+
| string-immutable-operations.js:2:13:2:20 | source() | string-immutable-operations.js:9:10:9:26 | concatWellFormedX |
215+
| string-immutable-operations.js:11:10:11:17 | source() | string-immutable-operations.js:11:10:11:32 | source( ... ormed() |
212216
| string-replace.js:3:13:3:20 | source() | string-replace.js:14:10:14:13 | data |
213217
| string-replace.js:3:13:3:20 | source() | string-replace.js:18:10:18:13 | data |
214218
| string-replace.js:3:13:3:20 | source() | string-replace.js:21:6:21:41 | safe(). ... taint) |
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
function test() {
22
let x = source();
3-
sink(x.toWellFormed()); // NOT OK -- Currently not tainted, but should be
3+
sink(x.toWellFormed()); // NOT OK
44

55
const wellFormedX = x.toWellFormed();
6-
sink(wellFormedX); // NOT OK -- Currently not tainted, but should be
6+
sink(wellFormedX); // NOT OK
77

88
const concatWellFormedX = "/" + wellFormedX + "!";
9-
sink(concatWellFormedX); // NOT OK -- Currently not tainted, but should be
9+
sink(concatWellFormedX); // NOT OK
1010

11-
sink(source().toWellFormed()); // NOT OK -- Currently not tainted, but should be
11+
sink(source().toWellFormed()); // NOT OK
1212
}

0 commit comments

Comments
 (0)