patchstack-audit

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0

README

PatchStack Audit

Reproduce a declared ordered patch series against pinned local source bytes, using a Go CLI or the importable pkg/patchstack library. A successful run publishes the resulting source tree and deterministic JSON/Markdown evidence together.

Hashes establish byte identity. Clean patch application establishes reproduction of the declared inputs. Neither proves trusted provenance, a security repair, CVE applicability, a successful build, or compliance. The tool does not download inputs, discover fixes, build software or run its tests.

The CLI and library are implemented. v0.1.0 release publication and public pkg.go.dev indexing are pending; this checkout is the current installation source. Prepared release archives are not evidence of a published release.

Build and try the original demonstration

Run on Linux with Go 1.27.4, GNU patch (2.7.6 is the tested version), a mounted /proc exposing this process's retained file descriptors, and a filesystem supporting Linux atomic no-replace rename. Use the local Linux container workflow on other hosts with Docker and a POSIX shell.

Make Go 1.27.4 the go command on PATH. Prepare the pinned dependency while network access is enabled:

GOTOOLCHAIN=go1.27.4 go mod download

Then build and run offline from the repository root:

export GOTOOLCHAIN=local GOPROXY=off GOSUMDB=off GOFLAGS=-mod=readonly
go build -o bin/patchstack ./cmd/patchstack
work=$(mktemp -d)
go run ./examples/demo --output "$work/inputs"
./bin/patchstack audit \
  --manifest "$work/inputs/stack.yaml" \
  --input-root "$work/inputs" \
  --output "$work/result" \
  --format json > "$work/stdout.json"
cmp "$work/stdout.json" "$work/result/report.json"

Locally prepared binary candidate archives also contain ready-to-run example-inputs/. In an extracted archive for your Linux architecture, use ./patchstack audit --manifest example-inputs/stack.yaml --input-root example-inputs --output result. This needs GNU patch and the Linux runtime prerequisites, but does not need Go. See archive verification before using a candidate. Public release publication remains pending.

The original tiny C example and its two patches use declared provenance local:demonstration. The generator creates the source archive, patch inventory and manifest locally and reproducibly. It makes no claim about a real CVE.

A successful output contains exactly source/, report.json and report.md. The output parent must already exist, the destination must be absent, and output must be outside the input root. Exit 0 means reproduced; 1 means an input hash, inventory or patch-application mismatch; 2 means an operational or usage error. A closed stdout pipe after publication returns 2 and retains the complete output with its location on stderr.

Read more

License

Original code and original demonstration/test fixtures use Apache-2.0. The pinned YAML dependency retains its third-party notices. CLI binary archives also include the Go runtime's BSD-3-Clause license and PATENTS grant, copied verbatim from Go 1.27.4. All these notices accompany binary distributions. Declared upstream patch references do not relicense third-party input.

Directories

Path Synopsis
cmd
patchstack command
Command patchstack audits a local declared patch series.
Command patchstack audits a local declared patch series.
examples
demo command
Command demo generates the original two-patch local demonstration inputs.
Command demo generates the original two-patch local demonstration inputs.
demo/fixtures
Package fixtures creates an original, deterministic local demonstration.
Package fixtures creates an original, deterministic local demonstration.
internal
cli
Package cli parses command arguments and presents the shared audit API.
Package cli parses command arguments and presents the shared audit API.
contracts
Package contracts defines the version 1 data and adapter contracts.
Package contracts defines the version 1 data and adapter contracts.
executor
Package executor applies a complete verified series to a private prepared workspace using real GNU patch on Linux.
Package executor applies a complete verified series to a private prepared workspace using real GNU patch on Linux.
inputfs
Package inputfs provides the retained, read-only input root used during preparation.
Package inputfs provides the retained, read-only input root used during preparation.
patchinput
Package patchinput verifies a complete patch directory and freezes its declared bytes into private staging.
Package patchinput verifies a complete patch directory and freezes its declared bytes into private staging.
publish
Package publish keeps a completed output package private until one Linux atomic no-replace rename makes it visible at the requested destination.
Package publish keeps a completed output package private until one Linux atomic no-replace rename makes it visible at the requested destination.
source
Package source freezes and verifies a declared source archive before extracting regular files and directories into a caller-owned private empty workspace.
Package source freezes and verifies a declared source archive before extracting regular files and directories into a caller-owned private empty workspace.
treedigest
Package treedigest computes the version 1 canonical source tree inventory and restores intended publication modes only after readable content is hashed.
Package treedigest computes the version 1 canonical source tree inventory and restores intended publication modes only after readable content is hashed.
pkg
patchstack
Package patchstack exposes the local patch-series audit API.
Package patchstack exposes the local patch-series audit API.
scripts
acceptance command
Command acceptance exercises the real CLI with original local fixtures.
Command acceptance exercises the real CLI with original local fixtures.
librarycheck command
This program is copied into a temporary external module by test-library.sh.
This program is copied into a temporary external module by test-library.sh.

Jump to

Keyboard shortcuts

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