5
5
import javascript
6
6
private import semmle.javascript.security.dataflow.ServerSideUrlRedirectCustomizations
7
7
private import semmle.javascript.dataflow.internal.PreCallGraphStep
8
- private import semmle.javascript.internal.NameResolution
9
- private import semmle.javascript.internal.TypeResolution
10
8
11
9
/**
12
10
* Provides classes and predicates for reasoning about [Nest](https://nestjs.com/).
@@ -137,7 +135,7 @@ module NestJS {
137
135
hasSanitizingPipe ( this , true ) and
138
136
// Note: we could consider types with class-validator decorators to be sanitized here, but instead we consider the root
139
137
// object to be tainted, but omit taint steps for the individual properties names that have sanitizing decorators. See ClassValidator.qll.
140
- TypeResolution :: isSanitizingPrimitiveType ( this .getParameter ( ) .getTypeAnnotation ( ) )
138
+ this .getParameter ( ) .getTypeBinding ( ) . isSanitizingPrimitiveType ( )
141
139
}
142
140
}
143
141
@@ -337,9 +335,10 @@ module NestJS {
337
335
handler .isReturnValueReflected ( ) and
338
336
this = handler .getAReturn ( ) and
339
337
// Only returned strings are sinks. If we can find a type for the return value, it must be string-like.
340
- not exists ( NameResolution:: Node type |
341
- TypeResolution:: valueHasType ( this .asExpr ( ) , type ) and
342
- not TypeResolution:: hasUnderlyingStringOrAnyType ( type )
338
+ (
339
+ this .asExpr ( ) .getTypeBinding ( ) .hasUnderlyingStringOrAnyType ( )
340
+ or
341
+ not exists ( this .asExpr ( ) .getTypeBinding ( ) )
343
342
)
344
343
}
345
344
@@ -475,7 +474,7 @@ module NestJS {
475
474
476
475
/** Gets the class being referenced at `node` without relying on the call graph. */
477
476
private DataFlow:: ClassNode getClassFromNode ( DataFlow:: Node node ) {
478
- result . getAstNode ( ) = node .analyze ( ) .getAValue ( ) .( AbstractClass ) . getClass ( )
477
+ result = node .asExpr ( ) .getNameBinding ( ) .getClassNode ( )
479
478
}
480
479
481
480
private predicate providerClassPair (
@@ -491,7 +490,7 @@ module NestJS {
491
490
private class DependencyInjectionStep extends PreCallGraphStep {
492
491
override predicate classInstanceSource ( DataFlow:: ClassNode cls , DataFlow:: Node node ) {
493
492
exists ( DataFlow:: ClassNode interfaceClass |
494
- node .asExpr ( ) .( Parameter ) . getType ( ) . ( ClassType ) . getClass ( ) = interfaceClass .getAstNode ( ) and
493
+ node .asExpr ( ) .getTypeBinding ( ) . getTypeDefinition ( ) = interfaceClass .getAstNode ( ) and
495
494
providerClassPair ( interfaceClass , cls )
496
495
)
497
496
}
0 commit comments