Skip to content

Commit f733ac1

Browse files
committed
JS: Make (most) queries use ActiveThreatModelSource
7 cases looks something like this: ``` class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { RemoteFlowSourceAsSource() { not this instanceof ClientSideRemoteFlowSource } } ``` (some have variations like `not this.(ClientSideRemoteFlowSource).getKind().isPathOrUrl()`) javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideUrlRedirectCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/CommandInjectionCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/CorsMisconfigurationForCredentialsCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/RegExpInjectionCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/RequestForgeryCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/ResourceExhaustionCustomizations.qll javascript/ql/lib/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll
1 parent 4b1c027 commit f733ac1

13 files changed

+95
-26
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ module CodeInjection {
2727
*/
2828
abstract class Sanitizer extends DataFlow::Node { }
2929

30-
/** A source of remote user input, considered as a flow source for code injection. */
31-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
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, ActiveThreatModelSource { }
3239

3340
/**
3441
* An expression which may be interpreted as an AngularJS expression.

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ module ConditionalBypass {
2929
abstract class Sanitizer extends DataFlow::Node { }
3030

3131
/**
32-
* A source of remote user input, considered as a flow source for bypass of
33-
* sensitive action guards.
32+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
3433
*/
35-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
34+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
35+
36+
/**
37+
* An active threat-model source, considered as a flow source.
38+
*/
39+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
3640

3741
/**
3842
* Holds if `bb` dominates the basic block in which `action` occurs.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ module DeepObjectResourceExhaustion {
2323
override DataFlow::FlowLabel getAFlowLabel() { result = TaintedObject::label() }
2424
}
2525

26-
private class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
26+
/** An active threat-model source, considered as a flow source. */
27+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource {
2728
override DataFlow::FlowLabel getAFlowLabel() { result.isTaint() }
2829
}
2930

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,15 @@ module DomBasedXss {
331331
isOptionallySanitizedEdgeInternal(_, node)
332332
}
333333

334-
/** A source of remote user input, considered as a flow source for DOM-based XSS. */
335-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
334+
/**
335+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
336+
*/
337+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
338+
339+
/**
340+
* An active threat-model source, considered as a flow source.
341+
*/
342+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
336343

337344
/**
338345
* A flow-label representing tainted values where the prefix is attacker controlled.

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,15 @@ module NosqlInjection {
3030
*/
3131
abstract class Sanitizer extends DataFlow::Node { }
3232

33-
/** A source of remote user input, considered as a flow source for NoSql injection. */
34-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
33+
/**
34+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
35+
*/
36+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
37+
38+
/**
39+
* An active threat-model source, considered as a flow source.
40+
*/
41+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
3542

3643
/** An expression interpreted as a NoSql query, viewed as a sink. */
3744
class NosqlQuerySink extends Sink instanceof NoSql::Query { }

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ module RemotePropertyInjection {
3131
abstract class Sanitizer extends DataFlow::Node { }
3232

3333
/**
34-
* A source of remote user input, considered as a flow source for remote property
35-
* injection.
34+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
3635
*/
37-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
36+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
37+
38+
/**
39+
* An active threat-model source, considered as a flow source.
40+
*/
41+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
3842

3943
/**
4044
* A sink for property writes with dynamically computed property name.

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ module SqlInjection {
2222
*/
2323
abstract class Sanitizer extends DataFlow::Node { }
2424

25-
/** A source of remote user input, considered as a flow source for string based query injection. */
26-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
25+
/**
26+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
27+
*/
28+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
29+
30+
/**
31+
* An active threat-model source, considered as a flow source.
32+
*/
33+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
2734

2835
/** An SQL expression passed to an API call that executes SQL. */
2936
class SqlInjectionExprSink extends Sink instanceof SQL::SqlString { }

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ module TemplateObjectInjection {
3434
override DataFlow::FlowLabel getAFlowLabel() { result = TaintedObject::label() }
3535
}
3636

37-
private class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource {
37+
/** An active threat-model source, considered as a flow source. */
38+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource {
3839
override DataFlow::FlowLabel getAFlowLabel() { result.isTaint() }
3940
}
4041

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ module UnsafeDeserialization {
2222
*/
2323
abstract class Sanitizer extends DataFlow::Node { }
2424

25-
/** A source of remote user input, considered as a flow source for unsafe deserialization. */
26-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
25+
/**
26+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
27+
*/
28+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
29+
30+
/**
31+
* An active threat-model source, considered as a flow source.
32+
*/
33+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
2734

2835
private API::Node unsafeYamlSchema() {
2936
result = API::moduleImport("js-yaml").getMember("DEFAULT_FULL_SCHEMA") // from older versions

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ module UnsafeDynamicMethodAccess {
5252
}
5353

5454
/**
55-
* A source of remote user input, considered as a source for unsafe dynamic method access.
55+
* DEPRECATED: Use `ActiveThreatModelSource` from Concepts instead!
5656
*/
57-
class RemoteFlowSourceAsSource extends Source instanceof RemoteFlowSource { }
57+
deprecated class RemoteFlowSourceAsSource = ActiveThreatModelSourceAsSource;
58+
59+
/**
60+
* An active threat-model source, considered as a flow source.
61+
*/
62+
private class ActiveThreatModelSourceAsSource extends Source, ActiveThreatModelSource { }
5863

5964
/**
6065
* A function invocation of an unsafe function, as a sink for remote unsafe dynamic method access.

0 commit comments

Comments
 (0)