Documentation ¶
Overview ¶
Package backtrace defines a dataflow analysis that finds all the backwards dataflow paths from an entrypoint. This analysis finds data flows which means that a backtrace consists of the data flowing backwards from an argument to the "backtracepoint" (entrypoint) call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMaxDepth = errors.New("configured max depth exceeded")
ErrMaxDepth is the error when the max depth is exceeded.
Functions ¶
Types ¶
type AnalysisReqs ¶
type AnalysisReqs struct { // Tag is the tag to analyze, ignored if non-empty. Tag string }
AnalysisReqs provides constraints on the backtrace analysis to run.
type AnalysisResult ¶
type AnalysisResult struct { // Graph is the cross function dataflow graph built by the dataflow analysis. It contains the linked summaries of // each function appearing in the program and analyzed. Graph df.InterProceduralFlowGraph // Traces represents all the paths where data flows out from the analysis entry points for each problem tag. Traces map[string]map[df.GraphNode][]Trace }
An AnalysisResult from the backtrace analysis contains a constructed a Graph representing the inter-procedural graph along with the traces found by the backtrace analysis in Traces
func Analyze ¶
func Analyze(state *df.State, reqs AnalysisReqs) (AnalysisResult, error)
Analyze runs the analysis on the program prog with the user-provided configuration config. If the analysis run successfully, an AnalysisResult is returned, containing all the information collected.
- cfg is the configuration that determines which functions are sources, sinks and sanitizers.
- prog is the built ssa representation of the program. The program must contain a main package and include all its dependencies, otherwise the pointer analysis will fail.
type FlowReports ¶
type FlowReports struct { Tag string Traces map[string][][]dataflow.ReportNodeInfo }
A FlowReports contains the information we serialize about backwards data flow traces. Traces are grouped by problem tag. A trace in the report is a list of dataflow.ReportNodeInfo.
type Trace ¶
type Trace []TraceNode
Trace represents a dataflow path (sequence of nodes) out of an analysis entrypoint.
The first node in the trace is the origin of the data flow.
The last node in the trace is an argument to the backtrace entrypoint function defined in the config.
type Visitor ¶
type Visitor struct { SlicingSpec *config.SlicingSpec Traces map[df.GraphNode][]Trace Errs []error // contains filtered or unexported fields }
Visitor implements the dataflow.Visitor interface and holds the specification of the problem to solve in the SlicingSpec as well as the set of traces.