mirror of
https://github.com/github/codeql.git
synced 2026-02-18 16:03:45 +01:00
Improve detection of UMD modules.
We previously required the `define` to appear directly as an expression statement, but there are common patterns where this is not the case.
This commit is contained in:
committed by
Erik Krogh Kristensen
parent
47e425a184
commit
ea70aaff57
@@ -5,6 +5,7 @@
|
||||
|
||||
import javascript
|
||||
private import semmle.javascript.internal.CachedStages
|
||||
private import Expressions.ExprHasNoEffect
|
||||
|
||||
/**
|
||||
* An AMD `define` call.
|
||||
@@ -26,7 +27,7 @@ private import semmle.javascript.internal.CachedStages
|
||||
*/
|
||||
class AmdModuleDefinition extends CallExpr {
|
||||
AmdModuleDefinition() {
|
||||
getParent() instanceof ExprStmt and
|
||||
inVoidContext(this) and
|
||||
getCallee().(GlobalVarAccess).getName() = "define" and
|
||||
exists(int n | n = getNumArgument() |
|
||||
n = 1
|
||||
|
||||
Reference in New Issue
Block a user