mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
19 lines
908 B
JavaScript
19 lines
908 B
JavaScript
// copied from tests for `UnsafeDynamicMethodAccess.ql` to check that they do not overlap
|
|
|
|
let obj = {};
|
|
|
|
window.addEventListener('message', (ev) => { // $ Source
|
|
let message = JSON.parse(ev.data);
|
|
window[message.name](message.payload); // $ MISSING: Alert - reported by UnsafeDynamicMethodAccess.ql
|
|
new window[message.name](message.payload); // $ MISSING: Alert - reported by UnsafeDynamicMethodAccess.ql
|
|
window["HTMLElement" + message.name](message.payload); // OK - concatenation restricts choice of methods
|
|
window[`HTMLElement${message.name}`](message.payload); // OK - concatenation restricts choice of methods
|
|
|
|
function f() {}
|
|
f[message.name](message.payload)(); // $ MISSING: Alert - reported by UnsafeDynamicMethodAccess.ql
|
|
|
|
obj[message.name](message.payload); // $ Alert
|
|
|
|
window[ev](ev); // $ MISSING: Alert - reported by UnsafeDynamicMethodAccess.ql
|
|
});
|