mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
JS: Use hasUnderlyingStringOrAnyType in Nest model
This commit is contained in:
@@ -318,14 +318,6 @@ module NestJS {
|
||||
}
|
||||
}
|
||||
|
||||
private predicate isStringType(Type type) {
|
||||
type instanceof StringType
|
||||
or
|
||||
type instanceof AnyType
|
||||
or
|
||||
isStringType(type.(PromiseType).getElementType().unfold())
|
||||
}
|
||||
|
||||
/**
|
||||
* A return value from a route handler, seen as an argument to `res.send()`.
|
||||
*
|
||||
@@ -344,10 +336,10 @@ module NestJS {
|
||||
ReturnValueAsResponseSend() {
|
||||
handler.isReturnValueReflected() and
|
||||
this = handler.getAReturn() and
|
||||
// Only returned strings are sinks
|
||||
not exists(Type type |
|
||||
type = this.asExpr().getType() and
|
||||
not isStringType(type.unfold())
|
||||
// Only returned strings are sinks. If we can find a type for the return value, it must be string-like.
|
||||
not exists(NameResolution::Node type |
|
||||
TypeResolution::valueHasType(this.asExpr(), type) and
|
||||
not TypeResolution::hasUnderlyingStringOrAnyType(type)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user