inventory

package
v0.192.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

func (SARIF) Where added in v0.181.0

func (s SARIF) Where() string

Where is the path that decides which component the file belongs to: the file, or the directory its step runs in where the step does not name it.

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 Terraform or OpenTofu code or variables.
	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
	// CloudFormation are AWS CloudFormation templates.
	CloudFormation []string
	// AzureARM are Azure Resource Manager templates.
	AzureARM []string
	// TerraformPlans are Terraform plans written as JSON.
	TerraformPlans []string
	// Ansible are the entries that make a directory an Ansible project to Trivy: an ansible.cfg, an
	// inventory, group_vars, host_vars, roles or playbooks, or a playbook.
	Ansible []string
	// OpenAPI are OpenAPI and Swagger documents.
	OpenAPI []string
	// Serves are the files that say the tree runs something reached over a network: a Dockerfile
	// that exposes a port, a Kubernetes Service or Ingress, and a Compose file that publishes ports.
	Serves []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.

func Read

func Read(root string) Tree

Read walks root and returns what it holds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL