Documentation
¶
Overview ¶
Package inventory lists what a source tree holds that a control has something to say about: dependency files, vendored JavaScript, infrastructure code, Dockerfiles, API documents, and SARIF files another tool wrote, in the tree or from a CI step.
It is what `draugr init` reads to decide what a descriptor enables. Dependency files come from internal/manifests, so the files init proposes a scanner for are the files a scan later accounts for, and the two cannot disagree about what counts as one. A go.mod is found on its own as well, because the Go controls check a module that requires nothing and a scan has no packages to read from it.
Index ¶
Constants ¶
const ( ToolCodeQL = "CodeQL" ToolSemgrep = "Semgrep" ToolGosec = "gosec" ToolBandit = "Bandit" ToolSnykCode = "Snyk Code" ToolTrivy = "Trivy" ToolTrivyConfig = "Trivy config" ToolGrype = "Grype" ToolOSVScanner = "OSV-Scanner" ToolSnykOpenSource = "Snyk Open Source" ToolSnykContainer = "Snyk Container" ToolSnykIaC = "Snyk IaC" ToolDependencyCheck = "dependency-check" ToolCheckov = "Checkov" ToolKICS = "KICS" )
The tools Draugr recognizes by name, in a SARIF file's tool.driver.name or on a CI step.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SARIF ¶ added in v0.181.0
type SARIF struct {
// Path is the file, relative to the root. Empty where a CI step does not say which file it writes.
Path string
// Tool is the tool that wrote it, by the name Tools gives it, by the name the file states where
// that is not one of them, or empty where nothing says.
Tool string
// InTree reports whether the file is in the tree.
InTree bool
// Workflow is the CI file whose step writes or uploads the file, empty where none does.
Workflow string
// Dir is the directory the step runs in, relative to the root, and "." for a file in the tree.
// It places a file the step does not name.
Dir string
}
SARIF is a SARIF file another tool wrote: one the tree holds, or one a CI step writes or uploads. `draugr init` proposes importing it, commented out.
type Tree ¶
type Tree struct {
// Dependencies are the files that declare or pin packages.
Dependencies []manifests.File
// Unresolved are the dependency files a manifest scanner takes no packages from: a declared
// manifest with no lockfile, a requirements file with no exact version.
Unresolved []manifests.Unread
// TrivyUnread are dependency files Trivy does not read and Grype does.
TrivyUnread []manifests.File
// TrivyByPattern are the requirements files Trivy reads only where trivyFs.filePatterns names
// them: its pip analyzer opens requirements.txt and no other name.
TrivyByPattern []manifests.File
// Go are the directories holding a go.mod, whether or not it requires anything: standard-library
// code still has SAST findings, and still builds with a toolchain that has advisories of its own.
Go []string
// VendoredJS are JavaScript files committed as copies of a library rather than written here.
VendoredJS []string
// Terraform are the directories holding a .tf file.
Terraform []string
// Kubernetes are manifests outside a Helm chart.
Kubernetes []string
// Helm are the directories holding a Chart.yaml.
Helm []string
// Dockerfiles are the files an image is built from.
Dockerfiles []string
// OpenAPI are OpenAPI and Swagger documents.
OpenAPI []string
// Parts are the directories below the root that hold their own dependency file or go.mod, the
// units a monorepo is made of. A JavaScript workspace member, a directory the root package.json
// or pnpm-workspace.yaml names, is not one by its package.json alone: the lockfile at the
// workspace root resolves it, so it stays with that root.
Parts []string
// NonShipping are the directories holding documentation, examples or tests, by the names
// internal/nonshipping lists, outermost only: `test/` and not `test/integration/testdata/` beneath
// it. A directory under vendor/ is someone else's and is left out.
NonShipping []string
// SARIF are the SARIF files another tool wrote that a descriptor could import: the ones in the
// tree, then the ones a CI step writes or uploads that the tree does not hold. Draugr's own output
// and files under NonShipping are left out.
SARIF []SARIF
}
Tree is what a directory holds. Every path is slash-separated and relative to the root.