mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge pull request #5135 from pwntester/guava_preconditions
Add support for the Preconditions Class in the Guava framework
This commit is contained in:
@@ -5,3 +5,4 @@
|
||||
import java
|
||||
import StringUtils
|
||||
import Collections
|
||||
import Preconditions
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/** Definitions of flow steps through the Preconditions class in the Guava framework. */
|
||||
|
||||
import java
|
||||
private import semmle.code.java.dataflow.FlowSteps
|
||||
|
||||
/**
|
||||
* The class `com.google.common.base.Preconditions`.
|
||||
*/
|
||||
class TypeGuavaPreconditions extends Class {
|
||||
TypeGuavaPreconditions() { this.hasQualifiedName("com.google.common.base", "Preconditions") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns its argumnets.
|
||||
*/
|
||||
private class GuavaPreconditionsMethod extends TaintPreservingCallable {
|
||||
GuavaPreconditionsMethod() {
|
||||
this.getDeclaringType() instanceof TypeGuavaPreconditions and
|
||||
this.hasName("checkNotNull")
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int src) { src = 0 }
|
||||
}
|
||||
Reference in New Issue
Block a user