Skip to content

Commit ca9ae8a

Browse files
committed
Added chaining modeling for underscore.string package.
1 parent 25c6fb5 commit ca9ae8a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

javascript/ql/lib/ext/underscore.string.model.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
extensions:
2+
- addsTo:
3+
pack: codeql/javascript-all
4+
extensible: typeModel
5+
data:
6+
- ["'underscore.string'.Wrapper", "'underscore.string'", "ReturnValue"]
7+
- ["'underscore.string'.Wrapper", "'underscore.string'.Wrapper", "Member[slugify,capitalize,decapitalize,clean,cleanDiacritics,swapCase,escapeHTML,unescapeHTML,wrap,dedent,reverse,pred,succ,titleize,camelize,classify,underscored,dasherize,humanize,trim,ltrim,rtrim,truncate,sprintf,strRight,strRightBack,strLeft,strLeftBack,stripTags,unquote,value].ReturnValue"]
8+
- ["'underscore.string'.Wrapper", "'underscore.string'.Wrapper", "Member[insert,replaceAll,join,splice,prune,pad,lpad,rpad,repeat,surround,quote].ReturnValue"]
9+
210
- addsTo:
311
pack: codeql/javascript-all
412
extensible: summaryModel
@@ -10,3 +18,10 @@ extensions:
1018
- ["'underscore.string'", "Member[splice]", "Argument[0,3]", "ReturnValue", "taint"]
1119
- ["'underscore.string'", "Member[join]", "Argument[0..N-1]", "ReturnValue", "taint"]
1220
- ["'underscore.string'", "Member[surround,quote]", "Argument[0,1]", "ReturnValue", "taint"]
21+
- ["'underscore.string'", "", "Argument[0]", "ReturnValue", "taint"]
22+
- ["'underscore.string'.Wrapper", "Member[slugify,capitalize,decapitalize,clean,cleanDiacritics,swapCase,escapeHTML,unescapeHTML,wrap,dedent,reverse,pred,succ,titleize,camelize,classify,underscored,dasherize,humanize,trim,ltrim,rtrim,truncate,sprintf,strRight,strRightBack,strLeft,strLeftBack,stripTags,unquote,value]", "Argument[this]", "ReturnValue", "taint"]
23+
- ["'underscore.string'.Wrapper", "Member[insert,replaceAll,join,splice,prune,pad,lpad,rpad,repeat,surround,quote]", "Argument[this]", "ReturnValue", "taint"]
24+
- ["'underscore.string'.Wrapper", "Member[insert,replaceAll,prune,pad,lpad,rpad,repeat]", "Argument[1]", "ReturnValue", "taint"]
25+
- ["'underscore.string'.Wrapper", "Member[surround,quote]", "Argument[0]", "ReturnValue", "taint"]
26+
- ["'underscore.string'.Wrapper", "Member[splice]", "Argument[2]", "ReturnValue", "taint"]
27+
- ["'underscore.string'.Wrapper", "Member[join]", "Argument[0..N-1]", "ReturnValue", "taint"]

javascript/ql/test/library-tests/TripleDot/underscore.string.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ function chaining() {
8888
.reverse().pred().succ().titleize().camelize().classify()
8989
.underscored().dasherize().humanize().trim().ltrim().rtrim()
9090
.truncate().sprintf().strRight().strRightBack()
91-
.strLeft().strLeftBack().stripTags().unquote().value()); // $ MISSING: hasTaintFlow=s1
91+
.strLeft().strLeftBack().stripTags().unquote().value()); // $ hasTaintFlow=s1
9292

9393
sink(s(source("s2"))
9494
.insert(4, source("s3")).replaceAll("a", source("s4"))
9595
.join(",", source("s5")).splice(1, 2, source("s6"))
9696
.prune(1, source("s7")).pad(10, source("s8"), "right")
9797
.lpad(10, source("s9")).rpad(10, source("s10"))
9898
.repeat(3, source("s11")).surround(source("s12"))
99-
.quote(source("s13")).value()); // $ MISSING: hasTaintFlow=s2 MISSING: hasTaintFlow=s3 MISSING: hasTaintFlow=s4 MISSING: hasTaintFlow=s5 MISSING: hasTaintFlow=s6 MISSING: hasTaintFlow=s7 MISSING: hasTaintFlow=s8 MISSING: hasTaintFlow=s9 MISSING: hasTaintFlow=s10 MISSING: hasTaintFlow=s11 MISSING: hasTaintFlow=s12 MISSING: hasTaintFlow=s13
99+
.quote(source("s13")).value()); // $ hasTaintFlow=s2 hasTaintFlow=s3 hasTaintFlow=s4 hasTaintFlow=s5 hasTaintFlow=s6 hasTaintFlow=s7 hasTaintFlow=s8 hasTaintFlow=s9 hasTaintFlow=s10 hasTaintFlow=s11 hasTaintFlow=s12 hasTaintFlow=s13
100100
}

0 commit comments

Comments
 (0)