Module ExternalFlow
INTERNAL use only. This is an experimental API subject to change without notice.
Provides classes and predicates for dealing with flow models specified in CSV format.
The CSV specification has the following columns:
- Sources:
namespace; type; subtypes; name; signature; ext; output; kind
- Sinks:
namespace; type; subtypes; name; signature; ext; input; kind
- Summaries:
namespace; type; subtypes; name; signature; ext; input; output; kind
The interpretation of a row is similar to API-graphs with a left-to-right reading.
-
The
namespace
column selects a package. -
The
type
column selects a type within that package. -
The
subtypes
is a boolean that indicates whether to jump to an arbitrary subtype of that type. Set this tofalse
if leaving thetype
blank (for example, a free function). -
The
name
column optionally selects a specific named member of the type. -
The
signature
column optionally restricts the named member. Ifsignature
is blank then no such filtering is done. The format of the signature is a comma-separated list of types enclosed in parentheses. The types can be short names or fully qualified names (mixing these two options is not allowed within a single signature). -
The
ext
column specifies additional API-graph-like edges. Currently there is only one valid value: "". -
The
input
column specifies how data enters the element selected by the first 6 columns, and theoutput
column specifies how data leaves the element selected by the first 6 columns. Aninput
can be either "", “Argument[n]”, “Argument[n1..n2]”, “ReturnValue”:- "": Selects a write to the selected element in case this is a field.
- “Argument[n]”: Selects an argument in a call to the selected element.
The arguments are zero-indexed, and
-1
specifies the qualifier. - “Argument[n1..n2]”: Similar to “Argument[n]” but select any argument in the given range. The range is inclusive at both ends.
- “ReturnValue”: Selects a value being returned by the selected element. This requires that the selected element is a method with a body.
An
output
can be either "", “Argument[n]”, “Argument[n1..n2]”, “Parameter”, “Parameter[n]”, “Parameter[n1..n2]”, or “ReturnValue”:- "": Selects a read of a selected field.
- “Argument[n]”: Selects the post-update value of an argument in a call to the
selected element. That is, the value of the argument after the call returns.
The arguments are zero-indexed, and
-1
specifies the qualifier. - “Argument[n1..n2]”: Similar to “Argument[n]” but select any argument in the given range. The range is inclusive at both ends.
- “Parameter[n]”: Similar to “Parameter” but restricted to a specific
numbered parameter (zero-indexed, and
-1
specifies the value ofthis
). - “Parameter[n1..n2]”: Similar to “Parameter[n]” but selects any parameter in the given range. The range is inclusive at both ends.
- “ReturnValue”: Selects the return value of a call to the selected element.
-
The
kind
column is a tag that can be referenced from QL to determine to which classes the interpreted elements should be added. For example, for sources “remote” indicates a default remote flow source, and for summaries “taint” indicates a default additional taint step and “value” indicates a globally applicable value-preserving step.
Import path
import codeql.swift.dataflow.ExternalFlow
Predicates
interpretElement | Gets the source/sink/summary element corresponding to the supplied parameters. |
matchesSignature | |
modelCoverage | Holds if MaD framework coverage of |
paramsString | Gets a parenthesized string containing all parameter types of this callable, separated by a comma. |
sinkModel | Holds if |
sinkModel | Holds if a sink model exists for the given parameters. |
sinkNode | Holds if |
sourceModel | Holds if |
sourceModel | Holds if a source model exists for the given parameters. |
sourceNode | Holds if |
summaryModel | Holds if |
summaryModel | Holds if a summary model exists for the given parameters. |
Classes
SinkModelCsv | A unit class for adding additional sink model rows. |
SourceModelCsv | A unit class for adding additional source model rows. |
SummaryModelCsv | A unit class for adding additional summary model rows. |
Modules
CsvValidation | Provides a query predicate to check the CSV data for validation errors. |