Merge pull request #1892 from asger-semmle/event-handler-sink

Approved by esben-semmle
This commit is contained in:
semmle-qlci
2019-09-09 15:33:21 +01:00
committed by GitHub
4 changed files with 24 additions and 0 deletions

View File

@@ -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
)
}
}
}