artifacts

package
v4.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 11 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 artifacts records every file the CLI writes in an artifact manifest, so a CI step can upload, attest or attach exactly those files without guessing at paths.

The manifest is named by --artifact-manifest or VULNETIX_ARTIFACT_MANIFEST; with neither, Record does nothing. It is JSON Lines, one entry per write, appended with O_APPEND so several CLI processes in one job (sca, then sast, then sbom) add to the same file without coordinating. A file written twice appears twice; readers keep the last entry for a path (Read does).

Index

Constants

View Source
const EnvVar = "VULNETIX_ARTIFACT_MANIFEST"

EnvVar names the manifest when the flag is not given.

Variables

View Source
var FlagPath string

FlagPath is set by the root --artifact-manifest flag.

Functions

func KindFor

func KindFor(path string) string

KindFor guesses an entry kind from a file name, for writers that do not say.

func Path

func Path() string

Path is the manifest in use, or "".

func Record

func Record(path, kind string)

Record appends path to the manifest. It never fails the write it records: an unwritable manifest costs the manifest, not the scan.

func SetCommand

func SetCommand(c string)

SetCommand names the command recorded with each entry.

func WriteFile

func WriteFile(path string, data []byte, perm os.FileMode, kind string) error

WriteFile writes data like os.WriteFile and records the file.

Types

type Entry

type Entry struct {
	// Path is as written, absolute when the manifest's directory differs.
	Path string `json:"path"`
	// Kind is what the file is: sarif, cyclonedx, openvex, report, signature,
	// certificate, attestation, ...
	Kind    string `json:"kind"`
	SHA256  string `json:"sha256,omitempty"`
	Bytes   int64  `json:"bytes"`
	Command string `json:"command,omitempty"`
	Written string `json:"written"`
}

Entry is one written file.

func Read

func Read(manifest string) ([]Entry, error)

Read returns the manifest's entries, the last entry for each path, sorted by path. Entries whose file no longer exists are dropped.

Jump to

Keyboard shortcuts

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