@@ -41,7 +41,7 @@ private class DefaultXssSink extends XssSink {
41
41
DefaultXssSink ( ) {
42
42
sinkNode ( this , "xss" )
43
43
or
44
- exists ( ServletWriterSourceToWritingMethodFlowConfig writer , MethodAccess ma |
44
+ exists ( XssVulnerableWriterSourceToWritingMethodFlowConfig writer , MethodAccess ma |
45
45
ma .getMethod ( ) instanceof WritingMethod and
46
46
writer .hasFlowToExpr ( ma .getQualifier ( ) ) and
47
47
this .asExpr ( ) = ma .getArgument ( _)
@@ -88,12 +88,6 @@ private class DefaultXssSink extends XssSink {
88
88
returnType instanceof RawClass
89
89
)
90
90
)
91
- or
92
- exists ( FacesWriterSourceToWritingMethodFlowConfig writer , MethodAccess ma |
93
- ma .getMethod ( ) instanceof WritingMethod and
94
- writer .hasFlowToExpr ( ma .getQualifier ( ) ) and
95
- this .asExpr ( ) = ma .getArgument ( _)
96
- )
97
91
}
98
92
}
99
93
@@ -108,12 +102,12 @@ private class DefaultXSSSanitizer extends XssSanitizer {
108
102
}
109
103
110
104
/** A configuration that tracks data from a servlet writer to an output method. */
111
- private class ServletWriterSourceToWritingMethodFlowConfig extends TaintTracking2:: Configuration {
112
- ServletWriterSourceToWritingMethodFlowConfig ( ) {
113
- this = "XSS::ServletWriterSourceToWritingMethodFlowConfig "
105
+ private class XssVulnerableWriterSourceToWritingMethodFlowConfig extends TaintTracking2:: Configuration {
106
+ XssVulnerableWriterSourceToWritingMethodFlowConfig ( ) {
107
+ this = "XSS::XssVulnerableWriterSourceToWritingMethodFlowConfig "
114
108
}
115
109
116
- override predicate isSource ( DataFlow:: Node src ) { src .asExpr ( ) instanceof ServletWriterSource }
110
+ override predicate isSource ( DataFlow:: Node src ) { src .asExpr ( ) instanceof XssVulnerableWriterSource }
117
111
118
112
override predicate isSink ( DataFlow:: Node sink ) {
119
113
exists ( MethodAccess ma |
@@ -135,9 +129,9 @@ private class WritingMethod extends Method {
135
129
}
136
130
}
137
131
138
- /** An output stream or writer that writes to a servlet response. */
139
- class ServletWriterSource extends MethodAccess {
140
- ServletWriterSource ( ) {
132
+ /** An output stream or writer that writes to a servlet, JSP or JSF response. */
133
+ class XssVulnerableWriterSource extends MethodAccess {
134
+ XssVulnerableWriterSource ( ) {
141
135
this .getMethod ( ) instanceof ServletResponseGetWriterMethod
142
136
or
143
137
this .getMethod ( ) instanceof ServletResponseGetOutputStreamMethod
@@ -146,6 +140,10 @@ class ServletWriterSource extends MethodAccess {
146
140
m .getDeclaringType ( ) .getQualifiedName ( ) = "javax.servlet.jsp.JspContext" and
147
141
m .getName ( ) = "getOut"
148
142
)
143
+ or
144
+ this .getMethod ( ) instanceof FacesGetResponseWriterMethod
145
+ or
146
+ this .getMethod ( ) instanceof FacesGetResponseStreamMethod
149
147
}
150
148
}
151
149
@@ -165,27 +163,3 @@ predicate isXssVulnerableContentType(string s) {
165
163
*/
166
164
bindingset [ s]
167
165
predicate isXssSafeContentType ( string s ) { not isXssVulnerableContentType ( s ) }
168
-
169
- /** An output stream or writer that writes to a JSF response. */
170
- class FacesWriterSource extends MethodAccess {
171
- FacesWriterSource ( ) {
172
- this .getMethod ( ) instanceof FacesGetResponseWriterMethod
173
- or
174
- this .getMethod ( ) instanceof FacesGetResponseStreamMethod
175
- }
176
- }
177
-
178
- /** A configuration that tracks data from a JSF writer to an output method. */
179
- private class FacesWriterSourceToWritingMethodFlowConfig extends TaintTracking2:: Configuration {
180
- FacesWriterSourceToWritingMethodFlowConfig ( ) {
181
- this = "XSS::FacesWriterSourceToWritingMethodFlowConfig"
182
- }
183
-
184
- override predicate isSource ( DataFlow:: Node src ) { src .asExpr ( ) instanceof FacesWriterSource }
185
-
186
- override predicate isSink ( DataFlow:: Node sink ) {
187
- exists ( MethodAccess ma |
188
- sink .asExpr ( ) = ma .getQualifier ( ) and ma .getMethod ( ) instanceof WritingMethod
189
- )
190
- }
191
- }
0 commit comments