@@ -9,7 +9,12 @@ import semmle.javascript.security.TaintedObject
99import semmle.javascript.dependencies.SemVer
1010
1111module PrototypePollution {
12+ import semmle.javascript.security.CommonFlowState
13+
1214 /**
15+ * DEPRECATED. This flow label is no longer in use, and there is no corresponding flow state, as
16+ * the query instead relies on implicit reads at the sinks.
17+ *
1318 * A label for wrappers around tainted objects, that is, objects that are
1419 * not completely user-controlled, but contain a user-controlled object.
1520 *
@@ -23,12 +28,12 @@ module PrototypePollution {
2328 * }
2429 * ```
2530 */
26- abstract class TaintedObjectWrapper extends DataFlow:: FlowLabel {
31+ abstract deprecated class TaintedObjectWrapper extends DataFlow:: FlowLabel {
2732 TaintedObjectWrapper ( ) { this = "tainted-object-wrapper" }
2833 }
2934
30- /** Companion module to the `TaintedObjectWrapper` class . */
31- module TaintedObjectWrapper {
35+ /** DEPRECATED. Use `FlowState::taintedObjectWrapper()` instead . */
36+ deprecated module TaintedObjectWrapper {
3237 /** Gets the instance of the `TaintedObjectWrapper` label. */
3338 TaintedObjectWrapper label ( ) { any ( ) }
3439 }
@@ -40,7 +45,10 @@ module PrototypePollution {
4045 /**
4146 * Gets the type of data coming from this source.
4247 */
43- abstract DataFlow:: FlowLabel getAFlowLabel ( ) ;
48+ FlowState getAFlowState ( ) { result .isTaintedObject ( ) }
49+
50+ /** DEPRECATED. Use `getAFlowState()` instead. */
51+ deprecated DataFlow:: FlowLabel getAFlowLabel ( ) { result = this .getAFlowState ( ) .toFlowLabel ( ) }
4452 }
4553
4654 /**
@@ -50,7 +58,10 @@ module PrototypePollution {
5058 /**
5159 * Gets the type of data that can taint this sink.
5260 */
53- abstract DataFlow:: FlowLabel getAFlowLabel ( ) ;
61+ FlowState getAFlowState ( ) { result .isTaintedObject ( ) }
62+
63+ /** DEPRECATED. Use `getAFlowState()` instead. */
64+ deprecated DataFlow:: FlowLabel getAFlowLabel ( ) { result = this .getAFlowState ( ) .toFlowLabel ( ) }
5465
5566 /**
5667 * Holds if `moduleName` is the name of the module that defines this sink,
@@ -68,14 +79,14 @@ module PrototypePollution {
6879 * in order to be flagged for prototype pollution.
6980 */
7081 private class RemoteFlowAsSource extends Source instanceof RemoteFlowSource {
71- override DataFlow :: FlowLabel getAFlowLabel ( ) { result .isTaint ( ) }
82+ override FlowState getAFlowState ( ) { result .isTaint ( ) }
7283 }
7384
7485 /**
7586 * A source of user-controlled objects.
7687 */
7788 private class TaintedObjectSource extends Source instanceof TaintedObject:: Source {
78- override DataFlow :: FlowLabel getAFlowLabel ( ) { result = TaintedObject :: label ( ) }
89+ override FlowState getAFlowState ( ) { result . isTaintedObject ( ) }
7990 }
8091
8192 class DeepExtendSink extends Sink {
@@ -98,12 +109,6 @@ module PrototypePollution {
98109 )
99110 }
100111
101- override DataFlow:: FlowLabel getAFlowLabel ( ) {
102- result = TaintedObject:: label ( )
103- or
104- result = TaintedObjectWrapper:: label ( )
105- }
106-
107112 override predicate dependencyInfo ( string moduleName_ , Locatable loc ) {
108113 moduleName = moduleName_ and
109114 location = loc
0 commit comments