Skip to content

Commit 00fd5ae

Browse files
authored
Merge pull request #22853 from ku-plrg/js/string-trim-normalize
JS: Add taint steps for trimStart, trimEnd and normalize
2 parents 6dc5ec9 + 407029a commit 00fd5ae

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added taint steps for `String.prototype.trimStart`, `trimEnd`, and `normalize`.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,10 @@ module TaintTracking {
455455
name =
456456
[
457457
"anchor", "big", "blink", "bold", "concat", "fixed", "fontcolor", "fontsize",
458-
"italics", "link", "padEnd", "padStart", "repeat", "replace", "replaceAll", "slice",
459-
"small", "strike", "sub", "substr", "substring", "sup", "toLocaleLowerCase",
460-
"toLocaleUpperCase", "toLowerCase", "toUpperCase", "trim", "trimLeft", "trimRight",
461-
"toWellFormed"
458+
"italics", "link", "normalize", "padEnd", "padStart", "repeat", "replace",
459+
"replaceAll", "slice", "small", "strike", "sub", "substr", "substring", "sup",
460+
"toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase", "toUpperCase", "trim",
461+
"trimEnd", "trimLeft", "trimRight", "trimStart", "toWellFormed"
462462
]
463463
or
464464
// sorted, interesting, properties of Object.prototype
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function trimming() {
2+
sink(source('trimStart').trimStart()); // $ hasTaintFlow=trimStart
3+
sink(source('trimEnd').trimEnd()); // $ hasTaintFlow=trimEnd
4+
sink(source('normalize').normalize('NFC')); // $ hasTaintFlow=normalize
5+
sink(source('trimLeft').trimLeft()); // $ hasTaintFlow=trimLeft
6+
}

0 commit comments

Comments
 (0)