Package-level declarations

Types

Link copied to clipboard
enum Result : Enum<Result>

A data class that serves as a ternary value for the analysis result.

Properties

Link copied to clipboard
val CokoBackend.cpg: TranslationResult

Functions

Link copied to clipboard
fun <T> Array<T>.allResult(predicate: (T) -> Result?): Result
fun <T> Iterable<T>.allResult(predicate: (T) -> Result?): Result

returns VALID if all Results are VALID, otherwise returns OPEN if any result is OPEN, otherwise returns INVALID

Link copied to clipboard
fun Result.and(other: Result): Result

precedence order for ternary and: OPEN INVALID VALID

Link copied to clipboard
fun <T> Array<T>.anyResult(predicate: (T) -> Result?): Result
fun <T> Iterable<T>.anyResult(predicate: (T) -> Result?): Result

returns VALID if any Result is VALID, otherwise returns OPEN if any result is OPEN, otherwise returns INVALID

Link copied to clipboard
fun CokoBackend.cpgCall(name: String, predicate: CallExpression.() -> Boolean = { true }): List<CallExpression>

Returns a list of CallExpressions with the matching name and fulfilling predicate.

Link copied to clipboard
fun CokoBackend.cpgCallFqn(fqn: String, predicate: CallExpression.() -> Boolean = { true }): List<CallExpression>

Returns a list of CallExpressions with the matching fqn (fully-qualified name) and fulfilling predicate.

Link copied to clipboard
fun CokoBackend.cpgConstructor(classFqn: String, predicate: CallExpression.() -> Boolean = { true }): List<ConstructExpression>

Returns a list of ConstructExpressions with the matching classFqn and fulfilling predicate.

Link copied to clipboard
infix fun Any.cpgFlowsTo(that: Node): Result

Checks if there's a data flow path from "this" to that.

infix fun Any.cpgFlowsTo(that: Collection<Node>): Result

Checks if there's a data flow path from "this" to any of the elements in that.

Link copied to clipboard
fun Op.cpgGetAllNodes(): Collection<CallExpression>

Get all Nodes that are associated with this Op.

Get all Nodes that are associated with this DataItem.

Link copied to clipboard
fun Op.cpgGetNodes(): Map<CallExpression, Result>

Get all Nodes that are associated with this Op and fulfill the Signatures of the Definitions.

Get all Nodes that are associated with this DataItem.

Link copied to clipboard
fun CokoBackend.cpgMemberExpr(predicate: MemberExpression.() -> Boolean): List<MemberExpression>

Returns a list of MemberExpressions with the matching something.

Link copied to clipboard
fun CallExpression.cpgSignature(vararg parameters: Any?, hasVarargs: Boolean = false): Result

Checks if the CallExpression matches the signature specified with parameters. Returns false if there are nulls in parameters,

Link copied to clipboard
fun CokoBackend.cpgVariable(name: String): List<ValueDeclaration>

Returns a list of ValueDeclarations with the matching name.

Link copied to clipboard
fun CokoBackend.cpgVariableFqn(fqn: String): List<ValueDeclaration>

Returns a list of ValueDeclarations with the matching fqn.

Link copied to clipboard
fun Node.findUsages(depth: Int = 5): Collection<Node>

To generate more interesting Findings we want to find key points where the forbidden operation influences other code. For this we traverse the DFG for a fixed amount of steps and search for all usages of declared values.