Package-level declarations

Types

Link copied to clipboard
class CodyzeDFAOrderEvaluator(referencedVertices: Set<Long>, nodesToOp: Map<Node, String>, thisPositionOfNode: Map<Node, Int>, val rule: MRule, val markContextHolder: MarkContextHolder, val ctx: AnalysisContext) : DFAOrderEvaluator

Codyze-specific implementation of the DFAOrderEvaluator. Its main purpose is to collect the findings in case of violations to the order.

Link copied to clipboard
open class Evaluator
Evaluates all loaded MARK rules against the CPG.
Link copied to clipboard
Compares duck typed values in expressions.
Link copied to clipboard
Indicates that a MARK expression could not be evaluated.
Link copied to clipboard
Link copied to clipboard
open class ExpressionHelper
Static helper methods for evaluating MARK expressions.
Link copied to clipboard
class ForbiddenEvaluator(markModel: Mark)
Link copied to clipboard

This class starts the order evaluation based on the CodyzeDFAOrderEvaluator.

Link copied to clipboard
open class OrderEvaluator

Functions

Link copied to clipboard
inline fun <T : Node> Graph.all(): List<T>

Returns all nodes with the type T.

inline fun <T : Node> Graph.all(pattern: String): List<T>

Returns all nodes with the type T and the name pattern.

Link copied to clipboard
fun argumentsMatchParameters(markParameters: List<Parameter>, sourceArguments: List<Expression>): Boolean

Returns true if the given list of arguments (of a function or method or constructor call) matches the given list of parameters in MARK.

Link copied to clipboard
fun Node.followNextDFG(predicate: (Node) -> Boolean): List<Node>?
Link copied to clipboard
fun ConstructExpression.getAssignee(): Node?
Link copied to clipboard
fun CallExpression.getBaseDeclaration(): Node?

Given a node that represents a CallExpression, return the base(s) that this call expression uses.

Link copied to clipboard
fun CallExpression.getBaseOfCallExpressionUsingArgument(argumentIndex: Int): Node?

This returns the "base" (MARK speech) object using the argument of a call expression. A common use-case is a non-objected oriented programming language, where the to-be-tracked object is passed as the first argument in a call expression.

Link copied to clipboard
fun Expression.getBaseOfInitializerArgument(): Node?

This returns the "base" (MARK speech) object of an expression that is contained as an argument in an initializer, e.g. in a construct or call expression.

Link copied to clipboard
fun Graph.getCalls(fqnName: String, parameters: List<Parameter>): MutableSet<CallExpression>

Returns a set of Vertices representing the CallExpression to a target function

Link copied to clipboard
fun Graph.getConstructs(fqnName: String, parameters: List<Parameter>): Set<ConstructExpression>

Returns a set of ConstructExpressions with a specified name and parameters

Link copied to clipboard
fun Graph.getField(fqnClassName: String, fieldName: String?): FieldDeclaration?
Link copied to clipboard
fun Node.getInitializerFor(): Expression?

If the expression is either a declaration of a reference to a declaration, it returns the initializer for the underlying declaration.

Link copied to clipboard
fun FieldDeclaration.getInitializerValue(): Any?
Link copied to clipboard
fun MRule.getMatchingReferences(graph: Graph, markVar: String, markModel: Mark): MutableList<NodeWithValue<Node>>

Returns a list of de.fraunhofer.aisec.cpg.graph.statements.expressions.DeclaredReferenceExpressions and values that correspond to a given MARK variable in a given rule.

Link copied to clipboard
fun Graph.getNodesForFunctionReference(markFunctionReference: FunctionDeclaration): Set<CallExpression>
Link copied to clipboard
fun Node.getSuitableDFGTarget(): Node?
Link copied to clipboard
fun Node.hasEOGTo(sink: Node, branchesAllowed: Boolean): Boolean

Checks, whether a EOG connection from this node (source) to the sink exists.

Link copied to clipboard
fun Graph.namespaces(pattern: String): List<NamespaceDeclaration>

Returns all namespaces, i.e. de.fraunhofer.aisec.cpg.graph.declarations.NamespaceDeclarations with the specified substring contained in the graph.

Link copied to clipboard
fun MRule.resolveOperand(graph: Graph, context: MarkContextHolder, markVar: String, markModel: Mark): Map<Int, MutableList<NodeWithValue<Node>>>

Properties

Link copied to clipboard
val Node.containingFunction: FunctionDeclaration?

Given a node, try to find the function or method in which the node is contained. The resulting Vertex will be of type FunctionDeclaration or MethodDeclaration. If v is not contained in a function, this method returns an empty Optional.

Link copied to clipboard
val Graph.functions: List<FunctionDeclaration>

Returns all functions, i.e. de.fraunhofer.aisec.cpg.graph.declarations.FunctionDeclarations contained in the graph.

Link copied to clipboard
val Node.initializedNode: Node?
Link copied to clipboard
val Graph.methods: List<MethodDeclaration>

Returns all methods, i.e. de.fraunhofer.aisec.cpg.graph.declarations.MethodDeclarations contained in the graph.

Link copied to clipboard
val Graph.namespaces: List<NamespaceDeclaration>

Returns all namespaces, i.e. de.fraunhofer.aisec.cpg.graph.declarations.NamespaceDeclarations contained in the graph.

Link copied to clipboard
val Node.nextStatement: Statement?
Link copied to clipboard
val Graph.records: List<RecordDeclaration>

Returns all records, i.e. de.fraunhofer.aisec.cpg.graph.declarations.RecordDeclarations contained in the graph.

Link copied to clipboard
val Graph.variables: List<VariableDeclaration>

Returns all variables, i.e. de.fraunhofer.aisec.cpg.graph.declarations.VariableDeclarations contained in the graph.