mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
JS: Ignore Angular templates in a few non-security queries
This commit is contained in:
@@ -68,5 +68,7 @@ where
|
||||
not exists(SsaImplicitInit init | init.getVariable().getSourceVariable() = v) // the variable is dead at the hoisted implicit initialization.
|
||||
then msg = "The initial value of " + v.getName() + " is unused, since it is always overwritten."
|
||||
else msg = "The value assigned to " + v.getName() + " here is unused."
|
||||
)
|
||||
) and
|
||||
// ignore Angular templates
|
||||
not dead.(ASTNode).getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
select dead, msg
|
||||
|
||||
@@ -299,7 +299,9 @@ where
|
||||
assign1 instanceof CallToObjectDefineProperty
|
||||
implies
|
||||
assign1.(CallToObjectDefineProperty).hasPropertyAttributeWrite("value", _)
|
||||
)
|
||||
) and
|
||||
// ignore Angular templates
|
||||
not assign1.getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
select assign1.getWriteNode(),
|
||||
"This write to property '" + name + "' is useless, since $@ always overrides it.",
|
||||
assign2.getWriteNode(), "another property write"
|
||||
|
||||
@@ -164,5 +164,7 @@ predicate hasNoEffect(Expr e) {
|
||||
top = e.getParent().(ExprStmt).getParent() and
|
||||
top.getNumChild() = 1 and
|
||||
not exists(Function fun | fun.getEnclosingContainer() = top)
|
||||
)
|
||||
) and
|
||||
// ignore Angular templates
|
||||
not e.getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
}
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
import javascript
|
||||
|
||||
from JSParseError pe
|
||||
where not pe.getTopLevel() instanceof Angular2::TemplateTopLevel
|
||||
select pe, pe.getMessage()
|
||||
|
||||
Reference in New Issue
Block a user