mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
41 lines
583 B
JavaScript
41 lines
583 B
JavaScript
function test() {
|
|
let x = source();
|
|
|
|
sink(x); // NOT OK
|
|
|
|
if (isSafe(x)) {
|
|
sink(x); // OK
|
|
}
|
|
}
|
|
|
|
class C {
|
|
method() {
|
|
this.x = source();
|
|
|
|
sink(this.x); // NOT OK
|
|
|
|
if (isSafe(this.x)) {
|
|
sink(this.x); // OK
|
|
|
|
addEventListener('hey', () => {
|
|
sink(this.x); // OK - but still flagged
|
|
});
|
|
}
|
|
|
|
addEventListener('hey', () => {
|
|
sink(this.x); // NOT OK
|
|
});
|
|
|
|
let self = this;
|
|
if (isSafe(self.x)) {
|
|
sink(self.x); // OK
|
|
}
|
|
|
|
addEventListener('hey', function() {
|
|
if (isSafe(self.x)) {
|
|
sink(self.x); // OK
|
|
}
|
|
});
|
|
}
|
|
}
|