Biphoo News

collapse
Home / Daily News Analysis / Witness: Open-source framework for verifying how your software was built

Witness: Open-source framework for verifying how your software was built

Oct 27, 2026  Twila Rosenbaum  44 views
Witness: Open-source framework for verifying how your software was built

A compiled binary arrives as a sealed box. It does not say which machine produced it, which source revision went into it, which compiler flags were applied, or whether anything was inserted between the last commit and the artifact that reaches customers. For most of the history of commercial software, that opacity was treated as normal. Attackers have learned to exploit it, and buyers, auditors, and regulators have started to ask for evidence rather than assurances.

Witness is an open-source command-line tool built to produce that evidence. It records how software gets built, signs the record, and checks the record against a policy before the software ships. TestifySec built Witness and donated it to the in-toto ecosystem within the Cloud Native Computing Foundation, and an open community now maintains it. The tool sits at the intersection of two long-running threads in software security: the push to make build systems emit verifiable provenance, and the shift toward policy-as-code for deciding which evidence is good enough to accept.

The gap between source code and shipping artifact

Software supply chain security spent years focused on the wrong end of the pipeline. Teams inventoried dependencies, scanned container images, and tracked vulnerabilities in third-party libraries. All of that work assumes the artifact under examination corresponds to the source code that was reviewed. That assumption is exactly what a compromised build system breaks. An attacker who controls a build runner, a CI credential, or a package publishing token can produce an artifact that behaves differently from anything in the repository, and conventional scanning will not notice, because the malicious behavior is not a known vulnerability signature.

Provenance is the countermeasure. Instead of trusting that a build did what it claimed, provenance records what actually happened and binds that record cryptographically to the resulting artifact. If a verifier can confirm which command ran, which inputs were consumed, and which identity signed the claim, then a tampered artifact either carries a record that contradicts policy or carries no valid record at all. Both outcomes are detectable before deployment rather than after an incident.

What a single run records

Witness works by wrapping the build command itself rather than observing it from outside. In the project's getting-started tutorial, an invocation of witness run --step build executes go build and writes a JSON file of attestations. Those attestations are signed statements about three things: the materials that went in, the command that executed, and the products that came out. Because the wrapper sees the process directly, the record reflects the actual invocation rather than a description supplied after the fact.

The output file is a DSSE envelope, the Dead Simple Signing Envelope format that has become a common wrapper for signed data across the supply chain tooling ecosystem. That choice matters practically: the file can be inspected with widely available utilities, decoded with jq and base64, and consumed by other tools that already understand DSSE. Nothing about the record requires a proprietary service to read. Adding the -a slsa flag to a run exports SLSA provenance alongside the other attestations, and the tutorial identifies that export as a mandatory requirement for SLSA Level 1, the entry tier of a graded build-integrity framework that ranges from basic provenance up to hardened, hermetic builds.

Provenance is not the same thing as a bill of materials

A software bill of materials and a provenance record are frequently conflated, and the distinction matters when designing a verification system. A bill of materials describes what is inside an artifact: components, versions, licenses, and by extension the vulnerabilities associated with them. It is a statement about composition. Provenance describes how the artifact came to exist: which pipeline ran, which inputs were fetched, which command was invoked, and who signed the claim. It is a statement about process.

Both are useful, and neither substitutes for the other. A bill of materials generated by a compromised pipeline is itself untrustworthy, which is why provenance has to sit underneath it. Witness concentrates on the process side, producing attestations that describe the build rather than the contents, though the materials list it captures overlaps with inventory data and can feed downstream analysis.

The policy is the actual gate

Collecting signed attestations is only half the job. The other half is deciding whether a given set of attestations is acceptable, and Witness expresses that decision as a JSON policy file. The policy names each step in the build, the attestation types that step is required to carry, and the public keys permitted to sign it. Custom rules are embedded as base64-encoded Rego, the policy language of the Open Policy Agent, which allows teams to encode organization-specific expectations without patching the tool.

Enforcement is strict by design. Witness requires every attestation within a step to pass its corresponding rule; a single failure is enough to reject the build. When verification fails, witness verify exits with a non-zero status code and states the reason for the failure. That behavior is what makes the tool usable in automation: a CI job does not need to parse prose or interpret ambiguous output, it simply stops on a non-zero exit and surfaces the stated reason to whoever is on call.

The policy is then signed. That final step closes a loop that is easy to leave open. Without a signed policy, an attacker who can modify the rules can simply declare their own artifact compliant, and the verification output becomes theater. Signing the policy binds the judgment criteria to an identity the verifier already trusts.

The demo key problem

There is a trap in the tutorial path that deserves attention. The getting-started guide signs the policy with the same testkey.pem file used to sign the build. For a demonstration that is convenient and entirely reasonable, since it keeps the number of moving parts small. In production, the arrangement would mean that a single stolen file could write both the evidence and the rules that judge it. An attacker holding that key could forge a build record and simultaneously rewrite the policy so that the forgery passes.

Avoiding that outcome requires separating the signing identities along trust boundaries. Build signing keys should live with the build system, ideally in a hardware security module or a cloud key management service that never exports raw key material. Policy signing keys should live with the security or platform team that owns the acceptance criteria, on a separate system with separate access controls. Keyless approaches reduce the burden further by replacing long-lived secrets with short-lived certificates bound to workload identity, which removes the static credential an attacker would most like to steal.

Deployment, integrations, and keyless signing

Witness integrates with GitHub, GitLab, AWS, and GCP, and it runs inside containers or directly on hosts without requiring elevated privileges. That last property is more consequential than it first appears. A verification tool that demands root access on a build runner is difficult to deploy in locked-down environments, and it widens the blast radius of any flaw in the tool itself. Running unprivileged keeps the trust footprint small.

Beyond the CI integrations, the tool supports keyless signing through Sigstore and SPIFFE/SPIRE, timestamps issued by RFC 3161 authorities, and storage of attestations in Archivista, a companion in-toto project built for keeping and querying signed records. Trusted timestamps matter because signatures alone prove authorship, not chronology; an RFC 3161 timestamp establishes that an attestation existed at a particular moment, which constrains an attacker who later gains access to a signing key and wants to backdate a forged record.

Verification without a network

Verification works across an air gap, provided the verifier holds three things: the signed policy, the artifact, and the matching public key. This is a deliberate design property rather than a side effect. Many organizations that care most about build integrity are precisely the ones that operate disconnected environments, including defense contractors, industrial operators, and regulated financial infrastructure. A verification model that requires a live connection to a transparency log or a vendor service would exclude them entirely. Offline verification also removes a dependency that could become an availability problem during an incident, when the ability to check an artifact is most needed.

Process tracing remains experimental

Among the capabilities the project documents, process tracing is still marked experimental. That label is worth taking at face value. Tracing a build's system calls and file accesses produces far richer evidence than wrapping the top-level command, and it is also far harder to do reliably across kernels, container runtimes, and language toolchains. Teams that need a stable, boring verification path should treat tracing as something to evaluate rather than something to depend on, while teams with unusual threat models may find the additional fidelity worth the rough edges.

Where the tool fits in a wider stack

Witness occupies a specific position in a crowded field. It is not a vulnerability scanner, a runtime protection agent, or a secrets manager. It is the component that answers the question of whether a given artifact was produced the way policy says it must have been produced. In practice that places it alongside in-toto layout verification, SLSA provenance generation, Sigstore-based signing and transparency, and Open Policy Agent for rule evaluation. The design leans on each of those standards rather than inventing replacements, which is why attestations produced by Witness are readable and reusable elsewhere.

The practical consequence is that adoption tends to be incremental. A team can start by wrapping a single build step and inspecting the resulting DSSE envelope to see what the record actually contains. From there, a minimal policy covering that one step establishes the exit-code gate in CI. Broader coverage follows as more steps get wrapped and more attestation types get required, and the signing keys move out of test files and into managed infrastructure. Each stage delivers value on its own, which is a healthier adoption curve than a big-bang migration.

What the tool does not solve

Build verification is not a complete defense. It cannot establish that source code is free of backdoors, that reviewers were diligent, or that a compiler was not itself compromised. It establishes that the artifact matches a recorded, signed process that satisfied a policy. If the policy is weak, if the signing keys are shared, or if the build environment was already compromised before the wrapper started, the evidence will faithfully record a bad build. The value lies in making those conditions detectable and in raising the cost of undetected tampering, not in eliminating the need for every other control.

The policy authoring burden should also be acknowledged honestly. Writing Rego rules that are strict enough to catch real deviations, yet permissive enough to tolerate legitimate variation in build outputs, takes iteration and a degree of familiarity with the language. Teams that treat policy as a one-time artifact will find it drifting out of alignment with their pipelines.

Witness is available for free on GitHub.


Source: Help Net Security News


Share:

Your experience on this site will be improved by allowing cookies Cookie Policy