File tree Expand file tree Collapse file tree
python/ql/src/experimental/semmle/python Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,23 +262,35 @@ module HTTP {
262262 /** Gets the data-flow node that specifies the content-type of this HTTP response, if any. */
263263 abstract DataFlow:: Node getContentTypeArg ( ) ;
264264
265+ /** Gets the default content-type that should be used if `getContentTypeArg` has no results. */
266+ abstract string getContentTypeDefault ( ) ;
267+
265268 /** Gets the content-type of this HTTP response, if it can be statically determined. */
266269 string getContentType ( ) {
267270 exists ( StrConst str |
268271 DataFlow:: localFlow ( DataFlow:: exprNode ( str ) , this .getContentTypeArg ( ) ) and
269272 result = str .getText ( )
270273 )
274+ or
275+ not exists ( this .getContentTypeArg ( ) ) and
276+ result = this .getContentTypeDefault ( )
271277 }
272278
273279 /** Gets the data-flow node that specifies the status code of this HTTP response, if any. */
274280 abstract DataFlow:: Node getStatusCodeArg ( ) ;
275281
282+ /** Gets the default status code that should be used if `getStatusCodeArg` has no results. */
283+ abstract int getStatusCodeDefault ( ) ;
284+
276285 /** Gets the status code of this HTTP response, if it can be statically determined. */
277286 int getStatusCode ( ) {
278287 exists ( IntegerLiteral i |
279288 DataFlow:: localFlow ( DataFlow:: exprNode ( i ) , this .getStatusCodeArg ( ) ) and
280289 result = i .getValue ( )
281290 )
291+ or
292+ not exists ( this .getStatusCodeArg ( ) ) and
293+ result = this .getStatusCodeDefault ( )
282294 }
283295 }
284296 }
You can’t perform that action at this time.
0 commit comments