Skip to content

Commit dc8e645

Browse files
committed
JS: Convert remaining queries to use ActiveThreatModelSourceAsSource
1 parent 19fae76 commit dc8e645

8 files changed

+79
-32
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@ module ClientSideUrlRedirect {
3838
DocumentUrl() { this = "document.url" }
3939
}
4040

41-
/** A source of remote user input, considered as a flow source for unvalidated URL redirects. */
42-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
43-
RemoteFlowSourceAsSource() { not this.(ClientSideRemoteFlowSource).getKind().isPath() }
41+
/**
42+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
43+
*/
44+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
45+
46+
/**
47+
* An active threat-model source, considered as a flow source.
48+
*/
49+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
50+
ActiveThreatModelSourceAsSource() { not this.(ClientSideRemoteFlowSource).getKind().isPath() }
4451

4552
override DataFlow::FlowLabel getAFlowLabel() {
4653
if this.(ClientSideRemoteFlowSource).getKind().isUrl()

javascript/ql/lib/semmle/javascript/security/dataflow/CommandInjectionCustomizations.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ module CommandInjection {
2525
*/
2626
abstract class Sanitizer extends DataFlow::Node { }
2727

28-
/** A source of remote user input, considered as a flow source for command injection. */
29-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
30-
RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
28+
/**
29+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
30+
*/
31+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
32+
33+
/**
34+
* An active threat-model source, considered as a flow source.
35+
*/
36+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
37+
ActiveThreatModelSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
3138

3239
override string getSourceType() { result = "a user-provided value" }
3340
}

javascript/ql/lib/semmle/javascript/security/dataflow/CorsMisconfigurationForCredentialsCustomizations.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ module CorsMisconfigurationForCredentials {
2727
*/
2828
abstract class Sanitizer extends DataFlow::Node { }
2929

30-
/** A source of remote user input, considered as a flow source for CORS misconfiguration. */
31-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
32-
RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
30+
/**
31+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
32+
*/
33+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
34+
35+
/**
36+
* An active threat-model source, considered as a flow source.
37+
*/
38+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
39+
ActiveThreatModelSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
3340
}
3441

3542
/**

javascript/ql/lib/semmle/javascript/security/dataflow/RegExpInjectionCustomizations.qll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ module RegExpInjection {
2626
abstract class Sanitizer extends DataFlow::Node { }
2727

2828
/**
29-
* A source of remote user input, considered as a flow source for regular
30-
* expression injection.
29+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
30+
*/
31+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
32+
33+
/**
34+
* An active threat-model source, considered as a flow source.
3135
*/
32-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
33-
RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
36+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
37+
ActiveThreatModelSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
3438
}
3539

3640
private import IndirectCommandInjectionCustomizations

javascript/ql/lib/semmle/javascript/security/dataflow/RequestForgeryCustomizations.qll

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,18 @@ module RequestForgery {
3939
*/
4040
abstract class Sanitizer extends DataFlow::Node { }
4141

42-
/** A source of server-side remote user input, considered as a flow source for request forgery. */
43-
private class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
44-
RemoteFlowSourceAsSource() { not this.(ClientSideRemoteFlowSource).getKind().isPathOrUrl() }
42+
/**
43+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
44+
*/
45+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
46+
47+
/**
48+
* An active threat-model source, considered as a flow source.
49+
*/
50+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
51+
ActiveThreatModelSourceAsSource() {
52+
not this.(ClientSideRemoteFlowSource).getKind().isPathOrUrl()
53+
}
4554

4655
override predicate isServerSide() { not this instanceof ClientSideRemoteFlowSource }
4756
}

javascript/ql/lib/semmle/javascript/security/dataflow/ResourceExhaustionCustomizations.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@ module ResourceExhaustion {
3131
*/
3232
abstract class Sanitizer extends DataFlow::Node { }
3333

34-
/** A source of remote user input, considered as a data flow source for resource exhaustion vulnerabilities. */
35-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
36-
RemoteFlowSourceAsSource() {
34+
/**
35+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
36+
*/
37+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
38+
39+
/**
40+
* An active threat-model source, considered as a flow source.
41+
*/
42+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
43+
ActiveThreatModelSourceAsSource() {
3744
// exclude source that only happen client-side
3845
not this instanceof ClientSideRemoteFlowSource and
3946
not this = DataFlow::parameterNode(any(PostMessageEventHandler pmeh).getEventParameter())

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,16 +572,15 @@ module TaintedPath {
572572
}
573573

574574
/**
575-
* A source of remote user input, considered as a flow source for
576-
* tainted-path vulnerabilities.
577-
*/
578-
class RemoteFlowSourceAsSource extends Source {
579-
RemoteFlowSourceAsSource() {
580-
exists(RemoteFlowSource src |
581-
this = src and
582-
not src instanceof ClientSideRemoteFlowSource
583-
)
584-
}
575+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
576+
*/
577+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
578+
579+
/**
580+
* An active threat-model source, considered as a flow source.
581+
*/
582+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
583+
ActiveThreatModelSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
585584
}
586585

587586
/**

javascript/ql/src/experimental/Security/CWE-942/CorsPermissiveConfigurationCustomizations.qll

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ module CorsPermissiveConfiguration {
2525
*/
2626
abstract class Sanitizer extends DataFlow::Node { }
2727

28-
/** A source of remote user input, considered as a flow source for CORS misconfiguration. */
29-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
30-
RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
28+
/**
29+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
30+
*/
31+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
32+
33+
/**
34+
* An active threat-model source, considered as a flow source.
35+
*/
36+
private class ActiveThreatModelSourceAsSource extends Source instanceof ActiveThreatModelSource {
37+
ActiveThreatModelSourceAsSource() { not this instanceof ClientSideRemoteFlowSource }
3138
}
3239

3340
/** A flow label representing `true` and `null` values. */

0 commit comments

Comments
 (0)