mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Merge pull request #1892 from asger-semmle/event-handler-sink
Approved by esben-semmle
This commit is contained in:
@@ -101,4 +101,18 @@ module CodeInjection {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An event handler attribute as a code injection sink.
|
||||
*/
|
||||
class EventHandlerAttributeSink extends Sink {
|
||||
EventHandlerAttributeSink() {
|
||||
exists(DOM::AttributeDefinition def |
|
||||
def.getName().regexpMatch("(?i)on.+") and
|
||||
this = def.getValueNode() and
|
||||
// JSX event handlers are functions, not strings
|
||||
not def instanceof JSXAttribute
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user