File tree Expand file tree Collapse file tree 2 files changed +28
-28
lines changed
javascript/ql/lib/semmle/javascript/security/dataflow Expand file tree Collapse file tree 2 files changed +28
-28
lines changed Original file line number Diff line number Diff line change @@ -137,34 +137,6 @@ module XssThroughDom {
137
137
/** DEPRECATED: Alias for DomTextSource */
138
138
deprecated class DOMTextSource = DomTextSource ;
139
139
140
- /**
141
- * A test of form `typeof x === "something"`, preventing `x` from being a string in some cases.
142
- *
143
- * This sanitizer helps prune infeasible paths in type-overloaded functions.
144
- */
145
- class TypeTestGuard extends TaintTracking:: SanitizerGuardNode , DataFlow:: ValueNode {
146
- override EqualityTest astNode ;
147
- Expr operand ;
148
- boolean polarity ;
149
-
150
- TypeTestGuard ( ) {
151
- exists ( TypeofTag tag | TaintTracking:: isTypeofGuard ( astNode , operand , tag ) |
152
- // typeof x === "string" sanitizes `x` when it evaluates to false
153
- tag = "string" and
154
- polarity = astNode .getPolarity ( ) .booleanNot ( )
155
- or
156
- // typeof x === "object" sanitizes `x` when it evaluates to true
157
- tag != "string" and
158
- polarity = astNode .getPolarity ( )
159
- )
160
- }
161
-
162
- override predicate sanitizes ( boolean outcome , Expr e ) {
163
- polarity = outcome and
164
- e = operand
165
- }
166
- }
167
-
168
140
/** The `files` property of an `<input />` element */
169
141
class FilesSource extends Source {
170
142
FilesSource ( ) { this = DOM:: domValueRef ( ) .getAPropertyRead ( "files" ) }
Original file line number Diff line number Diff line change @@ -52,6 +52,34 @@ class Configuration extends TaintTracking::Configuration {
52
52
}
53
53
}
54
54
55
+ /**
56
+ * A test of form `typeof x === "something"`, preventing `x` from being a string in some cases.
57
+ *
58
+ * This sanitizer helps prune infeasible paths in type-overloaded functions.
59
+ */
60
+ class TypeTestGuard extends TaintTracking:: SanitizerGuardNode , DataFlow:: ValueNode {
61
+ override EqualityTest astNode ;
62
+ Expr operand ;
63
+ boolean polarity ;
64
+
65
+ TypeTestGuard ( ) {
66
+ exists ( TypeofTag tag | TaintTracking:: isTypeofGuard ( astNode , operand , tag ) |
67
+ // typeof x === "string" sanitizes `x` when it evaluates to false
68
+ tag = "string" and
69
+ polarity = astNode .getPolarity ( ) .booleanNot ( )
70
+ or
71
+ // typeof x === "object" sanitizes `x` when it evaluates to true
72
+ tag != "string" and
73
+ polarity = astNode .getPolarity ( )
74
+ )
75
+ }
76
+
77
+ override predicate sanitizes ( boolean outcome , Expr e ) {
78
+ polarity = outcome and
79
+ e = operand
80
+ }
81
+ }
82
+
55
83
private import semmle.javascript.security.dataflow.Xss:: Shared as Shared
56
84
57
85
private class PrefixStringSanitizer extends TaintTracking:: SanitizerGuardNode ,
You can’t perform that action at this time.
0 commit comments