Skip to content

Commit fe02137

Browse files
committed
change naming of StringSplitCall methods
1 parent 4a26c29 commit fe02137

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

javascript/ql/src/Security/CWE-020/IncompleteUrlSchemeCheck.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class DangerousScheme extends string {
2828
DataFlow::SourceNode schemeOf(DataFlow::Node url) {
2929
// url.split(":")[0]
3030
exists(StringSplitCall split |
31-
split.getSplitAt() = ":" and
31+
split.getSeparator() = ":" and
3232
result = split.getAnElementRead(0) and
33-
url = split.getUnsplit()
33+
url = split.getBaseString()
3434
)
3535
or
3636
// url.getScheme(), url.getProtocol(), getScheme(url), getProtocol(url)

javascript/ql/src/Security/CWE-400/PrototypePollutionUtility.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import semmle.javascript.DynamicPropertyAccess
2323
*/
2424
class SplitCall extends StringSplitCall {
2525
SplitCall() {
26-
getSplitAt() = "." and
27-
getUnsplit() instanceof ParameterNode
26+
getSeparator() = "." and
27+
getBaseString() instanceof ParameterNode
2828
}
2929
}
3030

javascript/ql/src/semmle/javascript/StandardLibrary.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ class StringSplitCall extends DataFlow::MethodCallNode {
170170
}
171171

172172
/**
173-
* Gets a the SourceNode for the string before it is split.
173+
* Gets the DataFlow::Node for the base string that is split.
174174
*/
175-
DataFlow::SourceNode getUnsplit() { result = getReceiver().getALocalSource() }
175+
DataFlow::Node getBaseString() { result = getReceiver() }
176176

177177
/**
178178
* Gets a read of the `i`th element from the split string.

javascript/ql/src/semmle/javascript/security/dataflow/TaintedPath.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ module TaintedPath {
9898
)
9999
or
100100
// A `str.split()` call can either split into path elements (`str.split("/")`) or split by some other string.
101-
exists(StringSplitCall mcn | dst = mcn and mcn.getUnsplit() = src |
102-
if mcn.getSplitAt() = "/"
101+
exists(StringSplitCall mcn | dst = mcn and mcn.getBaseString() = src |
102+
if mcn.getSeparator() = "/"
103103
then
104104
srclabel.(Label::PosixPath).canContainDotDotSlash() and
105105
dstlabel instanceof Label::SplitPath

javascript/ql/src/semmle/javascript/security/dataflow/Xss.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ module DomBasedXss {
286286

287287
QueryPrefixSanitizer() {
288288
this = splitCall.getAnElementRead(0) and
289-
splitCall.getSplitAt() = "?" and
290-
splitCall.getUnsplit() = [DOM::locationRef(), DOM::locationRef().getAPropertyRead("href")]
289+
splitCall.getSeparator() = "?" and
290+
splitCall.getBaseString().getALocalSource() = [DOM::locationRef(), DOM::locationRef().getAPropertyRead("href")]
291291
}
292292
}
293293

0 commit comments

Comments
 (0)