55import javascript
66private import semmle.javascript.security.dataflow.ServerSideUrlRedirectCustomizations
77private import semmle.javascript.dataflow.internal.PreCallGraphStep
8- private import semmle.javascript.internal.NameResolution
9- private import semmle.javascript.internal.TypeResolution
108
119/**
1210 * Provides classes and predicates for reasoning about [Nest](https://nestjs.com/).
@@ -137,7 +135,7 @@ module NestJS {
137135 hasSanitizingPipe ( this , true ) and
138136 // Note: we could consider types with class-validator decorators to be sanitized here, but instead we consider the root
139137 // 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 ( )
141139 }
142140 }
143141
@@ -337,9 +335,10 @@ module NestJS {
337335 handler .isReturnValueReflected ( ) and
338336 this = handler .getAReturn ( ) and
339337 // 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 ( ) )
343342 )
344343 }
345344
@@ -475,7 +474,7 @@ module NestJS {
475474
476475 /** Gets the class being referenced at `node` without relying on the call graph. */
477476 private DataFlow:: ClassNode getClassFromNode ( DataFlow:: Node node ) {
478- result . getAstNode ( ) = node .analyze ( ) .getAValue ( ) .( AbstractClass ) . getClass ( )
477+ result = node .asExpr ( ) .getNameBinding ( ) .getClassNode ( )
479478 }
480479
481480 private predicate providerClassPair (
@@ -491,7 +490,7 @@ module NestJS {
491490 private class DependencyInjectionStep extends PreCallGraphStep {
492491 override predicate classInstanceSource ( DataFlow:: ClassNode cls , DataFlow:: Node node ) {
493492 exists ( DataFlow:: ClassNode interfaceClass |
494- node .asExpr ( ) .( Parameter ) . getType ( ) . ( ClassType ) . getClass ( ) = interfaceClass .getAstNode ( ) and
493+ node .asExpr ( ) .getTypeBinding ( ) . getTypeDefinition ( ) = interfaceClass .getAstNode ( ) and
495494 providerClassPair ( interfaceClass , cls )
496495 )
497496 }
0 commit comments