@@ -8,6 +8,7 @@ import javascript
88import DomBasedXssCustomizations:: DomBasedXss as DomBasedXssCustom
99import ReflectedXssCustomizations:: ReflectedXss as ReflectedXssCustom
1010import ExceptionXssCustomizations:: ExceptionXss
11+ private import ExceptionXssCustomizations:: ExceptionXss as ExceptionXss
1112private import semmle.javascript.dataflow.InferredTypes
1213import Xss:: Shared as XssShared
1314
@@ -71,7 +72,7 @@ predicate canThrowSensitiveInformation(DataFlow::Node node) {
7172}
7273
7374// Materialize flow labels
74- private class ConcreteNotYetThrown extends NotYetThrown {
75+ deprecated private class ConcreteNotYetThrown extends NotYetThrown {
7576 ConcreteNotYetThrown ( ) { this = this }
7677}
7778
@@ -130,25 +131,25 @@ private DataFlow::Node getExceptionTarget(DataFlow::Node pred) {
130131 * an exception.
131132 */
132133module ExceptionXssConfig implements DataFlow:: StateConfigSig {
133- class FlowState = DataFlow :: FlowLabel ;
134+ class FlowState = ExceptionXss :: FlowState ;
134135
135- predicate isSource ( DataFlow:: Node source , DataFlow :: FlowLabel label ) {
136- source .( Source ) .getAFlowLabel ( ) = label
136+ predicate isSource ( DataFlow:: Node source , FlowState state ) {
137+ source .( Source ) .getAFlowState ( ) = state
137138 }
138139
139- predicate isSink ( DataFlow:: Node sink , DataFlow :: FlowLabel label ) {
140- sink instanceof XssShared:: Sink and not label instanceof NotYetThrown
140+ predicate isSink ( DataFlow:: Node sink , FlowState state ) {
141+ sink instanceof XssShared:: Sink and not state = FlowState :: notYetThrown ( )
141142 }
142143
143144 predicate isBarrier ( DataFlow:: Node node ) {
144145 node instanceof XssShared:: Sanitizer or node = XssShared:: BarrierGuard:: getABarrierNode ( )
145146 }
146147
147148 predicate isAdditionalFlowStep (
148- DataFlow:: Node pred , DataFlow :: FlowLabel inlbl , DataFlow:: Node succ , DataFlow :: FlowLabel outlbl
149+ DataFlow:: Node pred , FlowState inlbl , DataFlow:: Node succ , FlowState outlbl
149150 ) {
150- inlbl instanceof NotYetThrown and
151- ( outlbl . isTaint ( ) or outlbl instanceof NotYetThrown ) and
151+ inlbl = FlowState :: notYetThrown ( ) and
152+ outlbl = [ FlowState :: thrown ( ) , FlowState :: notYetThrown ( ) ] and
152153 canThrowSensitiveInformation ( pred ) and
153154 succ = getExceptionTarget ( pred )
154155 }
@@ -178,7 +179,8 @@ deprecated class Configuration extends TaintTracking::Configuration {
178179 override predicate isAdditionalFlowStep (
179180 DataFlow:: Node pred , DataFlow:: Node succ , DataFlow:: FlowLabel inlbl , DataFlow:: FlowLabel outlbl
180181 ) {
181- ExceptionXssConfig:: isAdditionalFlowStep ( pred , inlbl , succ , outlbl )
182+ ExceptionXssConfig:: isAdditionalFlowStep ( pred , FlowState:: fromFlowLabel ( inlbl ) , succ ,
183+ FlowState:: fromFlowLabel ( outlbl ) )
182184 or
183185 // All the usual taint-flow steps apply on data-flow before it has been thrown in an exception.
184186 // Note: this step is not needed in StateConfigSig module since flow states inherit taint steps.
0 commit comments