mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Java: Model System.in as stdin threat-model
This commit is contained in:
@@ -207,7 +207,8 @@ deprecated class EnvInput extends DataFlow::Node {
|
||||
EnvInput() {
|
||||
this instanceof EnvironmentInput or
|
||||
this instanceof CliInput or
|
||||
this instanceof FileInput
|
||||
this instanceof FileInput or
|
||||
this instanceof StdinInput
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,12 +235,21 @@ private class CliInput extends LocalUserInput {
|
||||
exists(Field f | this.asExpr() = f.getAnAccess() |
|
||||
f.getAnAnnotation().getType().getQualifiedName() = "org.kohsuke.args4j.Argument"
|
||||
)
|
||||
or
|
||||
}
|
||||
|
||||
override string getThreatModel() { result = "commandargs" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A node with input from stdin.
|
||||
*/
|
||||
private class StdinInput extends LocalUserInput {
|
||||
StdinInput() {
|
||||
// Access to `System.in`.
|
||||
exists(Field f | this.asExpr() = f.getAnAccess() | f instanceof SystemIn)
|
||||
}
|
||||
|
||||
override string getThreatModel() { result = "commandargs" }
|
||||
override string getThreatModel() { result = "stdin" }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user