|
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 |
8 | 10 |
|
9 | 11 | /** |
10 | 12 | * Provides classes and predicates for reasoning about [Nest](https://nestjs.com/). |
@@ -133,7 +135,9 @@ module NestJS { |
133 | 135 | hasSanitizingPipe(this, false) |
134 | 136 | or |
135 | 137 | hasSanitizingPipe(this, true) and |
136 | | - isSanitizingType(this.getParameter().getType().unfold()) |
| 138 | + // Note: we could consider types with class-validator decorators to be sanitized here, but instead we consider the root |
| 139 | + // 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()) |
137 | 141 | } |
138 | 142 | } |
139 | 143 |
|
@@ -209,19 +213,6 @@ module NestJS { |
209 | 213 | dependsOnType = true |
210 | 214 | } |
211 | 215 |
|
212 | | - /** |
213 | | - * Holds if a parameter of type `t` is considered sanitized, provided it has been checked by `ValidationPipe` |
214 | | - * (which relies on metadata emitted by the TypeScript compiler). |
215 | | - */ |
216 | | - private predicate isSanitizingType(Type t) { |
217 | | - t instanceof NumberType |
218 | | - or |
219 | | - t instanceof BooleanType |
220 | | - // |
221 | | - // Note: we could consider types with class-validator decorators to be sanitized here, but instead we consider the root |
222 | | - // object to be tainted, but omit taint steps for the individual properties names that have sanitizing decorators. See ClassValidator.qll. |
223 | | - } |
224 | | - |
225 | 216 | /** |
226 | 217 | * A user-defined pipe class, for example: |
227 | 218 | * ```js |
|
0 commit comments