Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
Expand All @@ -18,8 +19,8 @@ jobs:
steps:
- name: Use canonical runner temporary directory
run: echo "TMPDIR=$RUNNER_TEMP" >> "$GITHUB_ENV"
- uses: actions/checkout@v7.0.1
- uses: actions/setup-go@v7.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.27.4
cache: false
Expand All @@ -31,8 +32,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-go@v7.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.27.4
cache: false
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
PYTHON
- name: Upload proof receipts
if: always()
uses: actions/upload-artifact@v7.0.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: proof-receipts
path: |
Expand All @@ -91,21 +92,21 @@ jobs:
env:
TRUSTED_REVIEW_POLICY_JSON: ${{ vars.PDD_REVIEW_POLICY }}
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: target
- name: Checkout independently pinned verifier orchestration
uses: actions/checkout@v7.0.1
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: 148f1398b2703a7724a44a43096e42f4875a8d74
ref: 4fe69675096a9e270ca3b97b8563d52a7c045af0
path: trusted-tooling
- uses: actions/setup-go@v7.0.0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.27.4
cache: false
- name: Build trusted CLI
working-directory: trusted-tooling
run: go build -ldflags '-X main.version=148f139-policy-gate' -o ../pdd-trusted ./cmd/pdd
run: go build -ldflags '-X main.version=v0.2.0-policy-gate' -o ../pdd-trusted ./cmd/pdd
- name: Read public authority policy from independently managed repository variable
run: |
python3 - <<'PYTHON'
Expand Down Expand Up @@ -133,7 +134,7 @@ jobs:
exit 1
fi
done
- uses: actions/upload-artifact@v7.0.2
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: authenticated-gate-evidence
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
RELEASE_VERSION: ${{ inputs.version }}
TRUSTED_REVIEW_POLICY_JSON: ${{ vars.PDD_REVIEW_POLICY }}
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/setup-go@v7.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: 1.27.4
cache: false
Expand All @@ -41,7 +41,7 @@ jobs:
(pathlib.Path(os.environ['RUNNER_TEMP']) / 'review-policy.json').write_text(json.dumps(policy))
PYTHON
python3 scripts/smoke.py --pdd "dist/extracted/pdd-kit-go_${RELEASE_VERSION}_linux_amd64/pdd" --version "$RELEASE_VERSION" --policy "$RUNNER_TEMP/review-policy.json"
- uses: actions/upload-artifact@v7.0.2
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pdd-kit-go-${{ inputs.version }}
path: dist/first/
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

## v0.2.1

- Prevent `status` from accepting historical success while another project
operation is active; honor status cancellation and recheck authorization after
input/log inspection.
- Reject unsigned approval/import operations that would replace a signed review,
preserving the active record on failure. Authorized signed renewal still works.
- Reassess saved Gobra and named Go-test output before accepting successful
receipts. Require the exact targeted postcondition failure for every killed
mutant; reject missing/truncated logs and contradictory verifier summaries.
- Clean up descendants when a check parent exits, including detached children.
Windows uses a kill-on-close Job Object and registers a suspended root before
allowing user code to run; unsupported containment fails closed.
- Require the final successful package event as well as each named test pass;
incomplete Go JSON cannot establish success.
- Pin CI action dependencies to immutable commit SHAs and verify feature branches
through pull requests, avoiding duplicate push/PR proof runs.
- Preserve separate diagnostic stderr while reassessing Go JSON evidence.
- Report the installed module version for `go install ...@v0.2.1` and provide
persistent, checksummed release binaries with reproducible build metadata.
- Update the independent signed CI gate to the previously qualified v0.2.0 tooling
commit. New orchestration is tested separately before promotion.

Supported proof language and host/trust boundaries remain explicit. Receipts are
local unsigned records; these checks do not turn them into proof certificates or
establish long-term deployment history.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ See [authenticated review gates](docs/signed-reviews.md) and
[production qualification](docs/production-readiness.md) for signed authority,
native platform checks and repeatable failure/recovery testing.

Install the tagged CLI with `go install github.com/cruskell/pdd-kit-go/cmd/pdd@v0.2.1`,
or download checksummed binaries from [Releases](https://github.com/cruskell/pdd-kit-go/releases).

## Quick start

The CLI uses only Go's standard library. Build with Go 1.20+ on a 64-bit host. Formal checks additionally require Docker and the pinned Gobra image, or a local Gobra jar with Java and Z3 configured.
Expand Down Expand Up @@ -119,7 +122,7 @@ There is no automatic fallback from failed formal verification to a green test r

## Receipts and trust

Verification and approval are protected by an OS-backed project lock, automatically released when the owning process exits. Concurrent runs are rejected. `.pdd/run.json` identifies the newest run; an interrupted or incomplete newest run cannot fall back to an older success. SIGINT/SIGTERM cancellation and per-check timeouts terminate child process groups on supported Unix hosts, and the Docker backend removes its verifier container. A canceled run records negative evidence.
Verification and approval are protected by an OS-backed project lock, automatically released when the owning process exits. Concurrent proof, approval and status operations are rejected. `.pdd/run.json` identifies the newest run; an interrupted or incomplete newest run cannot fall back to an older success. SIGINT/SIGTERM cancellation and per-check timeouts terminate child process groups on supported Unix hosts, and the Docker backend removes its verifier container. A canceled run records negative evidence.

Default-plan artifacts live under `.pdd/receipts/<UTC-run-id>/` (named plans use `.pdd/state/NAME/receipts/`): `receipt.json`, `receipt.md`, `inputs.json` and per-check logs. Receipts include source/plan SHA-256 digests, reviewer assertion, commit (when present), tool identities, commands, durations, outcomes, mutation results, trust assumptions, exclusions and gaps. They are ignored by Git; CI uploads them as artifacts.

Expand Down
19 changes: 16 additions & 3 deletions cmd/pdd/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
package main

import (
"github.com/cruskell/pdd-kit-go/internal/cli"
"os"
"runtime/debug"

"github.com/cruskell/pdd-kit-go/internal/cli"
)

var version = "0.2.0-dev"
// Set by release builds. go install @version obtains the module version below.
var version string

func buildVersion() string {
if version != "" {
return version
}
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" {
return info.Main.Version
}
return "0.2.1-dev"
}

func main() { os.Exit(cli.Run(os.Args[1:], os.Stdout, os.Stderr, version)) }
func main() { os.Exit(cli.Run(os.Args[1:], os.Stdout, os.Stderr, buildVersion())) }
24 changes: 18 additions & 6 deletions docs/distribution.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Install and reproduce a release

Versioned binaries and checksums are published on [GitHub Releases](https://github.com/cruskell/pdd-kit-go/releases).
Go users can install the tagged CLI directly:

```sh
go install github.com/cruskell/pdd-kit-go/cmd/pdd@v0.2.1
pdd --version
```

The installed version comes from Go module build information. Release archives
embed the same version explicitly; local checkout builds show a development
version. Verification still needs the Go toolchain and the pinned Gobra backend.

The CLI has no third-party Go dependencies. Development builds need Go 1.20+:

```sh
Expand All @@ -12,10 +24,10 @@ Release builds use the exact Go 1.27.4 toolchain. Fetch it from
From a clean checkout of the release commit, with Python 3 available:

```sh
GO=/path/to/go1.27.4/bin/go python3 scripts/release.py v0.1.0
GO=/path/to/go1.27.4/bin/go python3 scripts/release.py v0.2.1
```

The script produces five archives under `dist/v0.1.0`: Linux amd64/arm64,
The script produces five archives under `dist/v0.2.1`: Linux amd64/arm64,
macOS amd64/arm64 and Windows amd64, plus `BUILD.json` and `SHA256SUMS`.
It disables CGO, VCS stamping and local file paths, embeds the requested CLI
version, records the commit/toolchain/flags, and normalizes archive metadata.
Expand Down Expand Up @@ -55,10 +67,10 @@ example reviews, run actual proofs and HTTP tests, kill mutants and check stale
source handling. It needs Go and Docker with the pinned image already pulled:

```sh
python3 scripts/smoke.py --pdd /absolute/path/to/pdd --version v0.1.0
python3 scripts/smoke.py --pdd /absolute/path/to/pdd --version v0.2.1
```

The [release workflow](../.github/workflows/release.yml) builds and validates
artifacts on manual dispatch. It uploads CI artifacts and does not publish a
release or change repository access. A maintainer can attach the verified output
to a versioned GitHub release after reviewing its checks.
artifacts on manual dispatch. It uploads CI artifacts without publishing automatically. Validated output can be
attached to a versioned GitHub release after the source commit passes required
checks. Release publication never changes repository access.
9 changes: 9 additions & 0 deletions docs/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ an older green receipt. JSON artifacts are independently limited to 8 MiB.
Receipts made before the v2 input manifest must be regenerated with `prove`.
Existing contract approvals remain usable when their review digest still matches;
the input algorithm change alone does not approve new intent.

`status` takes the same exclusive project lock as proof and approval operations.
It refuses a concurrent operation instead of returning a historical green result.
Its input capture responds to cancellation, and it rechecks policy authorization
and expiration after inspecting inputs and logs. Successful receipts must retain
valid baseline logs (including every named Go test) and the exact targeted mutant
failure logs. Missing or truncated mutant evidence cannot establish success.
These checks detect inconsistent local records; receipts remain unsigned and
cannot authenticate their own execution against a malicious project owner.
26 changes: 26 additions & 0 deletions docs/production-readiness.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,29 @@ and the signed-authority job. The current authenticated gate covers both the
permission-aware slice core and the HTTP wallet with three repeated proofs per
plan. Consult the current commit's run rather than treating this historical run
as certification of subsequent changes.

## v0.2.1 integrity audit

`internal/pdd/integrity_test.go` reproduces and prevents concurrent-status reuse,
unsigned replacement of a signed approval, and successful receipt metadata whose
logs do not support the named tests/proofs or targeted mutation rejection. It also
covers canceled status, contradictory verifier summaries and truncated mutant
output. Diagnostic stderr remains separate from Go JSON events when saved evidence
is reassessed. Signed renewal remains supported. The real Gobra integration suite
and native platform jobs exercise these checks with the shipped examples.

The public repository's main branch requires proof, authenticated-gate and the
three native test jobs, including for administrators; force pushes and deletion
are disabled. This enforces the configured checks, not a claim of long-term
production history or support for every possible Go library.

Process qualification also covers a parent that exits while descendants retain its
pipes, and one whose descendants have detached their output. Unix cleanup runs on
every completion path. On Windows, the root starts suspended, is assigned to a
kill-on-close Job Object, and is resumed only after containment is established.
Cancellation terminates the job; completion closes it, cleaning up descendants.
Unexpected startup layouts or unavailable job assignment fail closed. This is
lifecycle containment, not an OS security sandbox for hostile project code.
The Windows implementation follows Microsoft's [Job Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects)
and [process creation flags](https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags)
documentation. Native CI must pass before this change is promoted.
10 changes: 10 additions & 0 deletions docs/signed-reviews.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@ Protect the CLI, gate workflow and authority configuration under your existing
repository/organization policy. Target tests execute host code: run them in an
isolated, disposable worker without secrets, with read-only trusted tooling where
possible. This mechanism is not an adversarial sandbox or a signed proof system.

## Preventing accidental downgrade

Once an active approval is signed, ordinary `approve` and `import-approval` cannot
replace it with an unsigned assertion, even when `--policy` was accidentally
omitted. Renew using `--signing-key` and the inspected digest, or import another
valid signed review. The rejection leaves the active approval unchanged. A corrupt
active record also requires inspection before an unsigned replacement. A project
owner can deliberately remove local state; the external CI policy must still be
required independently, since local state is not an authorization boundary.
4 changes: 2 additions & 2 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func Run(args []string, out, errOut io.Writer, version string) (exitCode int) {
if err != nil {
return printer.finish(1, nil, "execution", err, "")
}
_, latest, currentErr := pdd.StatusWithPolicy(cwd, plan, global.policy)
_, latest, currentErr := pdd.StatusContext(ctx, cwd, plan, global.policy)
current := currentErr == nil && latest == dir
data := receiptResult(receipt, dir, current)
if !global.json {
Expand All @@ -308,7 +308,7 @@ func Run(args []string, out, errOut io.Writer, version string) (exitCode int) {
}
return printer.finish(0, data, "", nil, "")
case "status":
receipt, dir, err := pdd.StatusWithPolicy(cwd, plan, global.policy)
receipt, dir, err := pdd.StatusContext(ctx, cwd, plan, global.policy)
data := receiptResult(receipt, dir, err == nil)
if err != nil {
return printer.finish(1, data, "status", err, "Run prove against the current approved plan to obtain current evidence.")
Expand Down
3 changes: 3 additions & 0 deletions internal/pdd/approval_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,8 @@ func ImportApprovalWithPolicy(root string, p Plan, source, policyPath string) (A
if string(a) != string(b) {
return approval, fmt.Errorf("imported saved review differs from current intent and contracts")
}
if err = protectSignedApproval(root, p, approval); err != nil {
return approval, err
}
return approval, WriteJSON(filepath.Join(root, p.stateFile("approval.json")), approval)
}
Loading
Loading