зеркало из https://github.com/github/codeql.git
JS: Add test for SourceNode not depending on flowsTo
This commit is contained in:
Родитель
ffbbdd7779
Коммит
171b131eb1
|
@ -0,0 +1 @@
|
|||
| Success |
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Test that fails to compile if the domain of `SourceNode` depends on `SourceNode.flowsTo` (recursively).
|
||||
*
|
||||
* This tests adds a negative dependency `flowsTo --!--> SourceNode`
|
||||
* so that the undesired edge `SourceNode --> flowsTo` completes a negative cycle.
|
||||
*/
|
||||
import javascript
|
||||
|
||||
class BadSourceNode extends DataFlow::SourceNode {
|
||||
BadSourceNode() {
|
||||
this.(DataFlow::PropRead).getPropertyName() = "foo"
|
||||
}
|
||||
|
||||
override predicate flowsTo(DataFlow::Node node) {
|
||||
not node instanceof DataFlow::SourceNode
|
||||
}
|
||||
}
|
||||
|
||||
select "Success"
|
|
@ -0,0 +1,2 @@
|
|||
// The contents of this file don't matter
|
||||
let x = 1;
|
Загрузка…
Ссылка в новой задаче