JS: Add event handler sink to code injection

This commit is contained in:
Asger F
2019-09-05 16:13:03 +01:00
parent fd2e8486e4
commit fa95871f46

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