Skip to content

Commit 42fc4ff

Browse files
committed
JS: Don't create new flow labels in *Customizations.qll files
1 parent 28b4492 commit 42fc4ff

13 files changed

+61
-11
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import UrlConcatenation
1414
module ClientSideUrlRedirect {
1515
import ClientSideUrlRedirectCustomizations::ClientSideUrlRedirect
1616

17+
// Materialize flow labels
18+
private class ConcreteDocumentUrl extends DocumentUrl {
19+
ConcreteDocumentUrl() { this = this }
20+
}
21+
1722
/**
1823
* A taint-tracking configuration for reasoning about unvalidated URL redirections.
1924
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module ClientSideUrlRedirect {
2929
* A flow label for values that represent the URL of the current document, and
3030
* hence are only partially user-controlled.
3131
*/
32-
class DocumentUrl extends DataFlow::FlowLabel {
32+
abstract class DocumentUrl extends DataFlow::FlowLabel {
3333
DocumentUrl() { this = "document.url" }
3434
}
3535

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import javascript
1414
module InsecureDownload {
1515
import InsecureDownloadCustomizations::InsecureDownload
1616

17+
// Materialize flow labels
18+
private class ConcreteSensitiveInsecureURL extends Label::SensitiveInsecureURL {
19+
ConcreteSensitiveInsecureURL() { this = this }
20+
}
21+
private class ConcreteInsecureURL extends Label::InsecureURL {
22+
ConcreteInsecureURL() { this = this }
23+
}
24+
1725
/**
1826
* A taint tracking configuration for download of sensitive file through insecure connection.
1927
*/

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import javascript
1212
module PostMessageStar {
1313
import PostMessageStarCustomizations::PostMessageStar
1414

15+
// Materialize flow labels
16+
private class ConcretePartiallyTaintedObject extends PartiallyTaintedObject {
17+
ConcretePartiallyTaintedObject() { this = this }
18+
}
19+
1520
/**
1621
* A taint tracking configuration for cross-window communication with unrestricted origin.
1722
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module PostMessageStar {
2626
/**
2727
* A flow label representing an object with at least one tainted property.
2828
*/
29-
class PartiallyTaintedObject extends DataFlow::FlowLabel {
29+
abstract class PartiallyTaintedObject extends DataFlow::FlowLabel {
3030
PartiallyTaintedObject() { this = "partially tainted object" }
3131
}
3232

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import semmle.javascript.dependencies.SemVer
1515
module PrototypePollution {
1616
import PrototypePollutionCustomizations::PrototypePollution
1717

18+
// Materialize flow labels
19+
private class ConcreteTaintedObjectWrapper extends TaintedObjectWrapper {
20+
ConcreteTaintedObjectWrapper() { this = this }
21+
}
22+
1823
/**
1924
* A taint tracking configuration for user-controlled objects flowing into deep `extend` calls,
2025
* leading to prototype pollution.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ module PrototypePollution {
2424
* }
2525
* ```
2626
*/
27-
module TaintedObjectWrapper {
28-
private class TaintedObjectWrapper extends DataFlow::FlowLabel {
29-
TaintedObjectWrapper() { this = "tainted-object-wrapper" }
30-
}
27+
abstract class TaintedObjectWrapper extends DataFlow::FlowLabel {
28+
TaintedObjectWrapper() { this = "tainted-object-wrapper" }
29+
}
3130

31+
/** Companion module to the `TaintedObjectWrapper` class. */
32+
module TaintedObjectWrapper {
33+
/** Gets the instance of the `TaintedObjectWrapper` label. */
3234
TaintedObjectWrapper label() { any() }
3335
}
3436

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ import javascript
1212
module TaintedPath {
1313
import TaintedPathCustomizations::TaintedPath
1414

15+
// Materialize flow labels
16+
private class ConcretePosixPath extends Label::PosixPath {
17+
ConcretePosixPath() { this = this }
18+
}
19+
private class ConcreteSplitPath extends Label::SplitPath {
20+
ConcreteSplitPath() { this = this }
21+
}
22+
1523
/**
1624
* A taint-tracking configuration for reasoning about tainted-path vulnerabilities.
1725
*/

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module TaintedPath {
5555
* There are currently four flow labels, representing the different combinations of
5656
* normalization and absoluteness.
5757
*/
58-
class PosixPath extends DataFlow::FlowLabel {
58+
abstract class PosixPath extends DataFlow::FlowLabel {
5959
Normalization normalization;
6060
Relativeness relativeness;
6161

@@ -113,7 +113,7 @@ module TaintedPath {
113113
/**
114114
* A flow label representing an array of path elements that may include "..".
115115
*/
116-
class SplitPath extends DataFlow::FlowLabel {
116+
abstract class SplitPath extends DataFlow::FlowLabel {
117117
SplitPath() { this = "splitPath" }
118118
}
119119
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ module UnsafeDynamicMethodAccess {
1414
private import DataFlow::FlowLabel
1515
import UnsafeDynamicMethodAccessCustomizations::UnsafeDynamicMethodAccess
1616

17+
// Materialize flow labels
18+
private class ConcreteUnsafeFunction extends UnsafeFunction {
19+
ConcreteUnsafeFunction() { this = this }
20+
}
21+
1722
/**
1823
* A taint-tracking configuration for reasoning about unsafe dynamic method access.
1924
*/

0 commit comments

Comments
 (0)