mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-30 03:44:38 +01:00
Remove the /cso test files, CI workflows and docs ahead of removing /cso (GST-3920) (#4837)
Deletes the tests, test fixtures, CI workflows, scripts and docs that exist only for /cso. Nothing changes for anyone using gstack. Why: this is the first half of removing /cso. The whole removal is too big to review in one pull request, so #4833 removes the skill and its helper code next. Nothing to do: #4833 lands right after this one. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
1145e80a47
commit
fd7e8c7b36
113 files changed
+47
-19061
No files matched your search
@@ -225,8 +225,8 @@ test/eng-test-plan-edit-approval.test.ts
|
||||
|
||||
The quoted-frame selector was folded into `test/plan-count-file-permission.test.ts` in the 2026-09 audit.
|
||||
|
||||
The publication/watchdog pair is `test/autoplan-publication-guard.test.ts` and
|
||||
`test/cso-watchdog.test.ts`. The live pair is
|
||||
The publication/watchdog pair was `test/autoplan-publication-guard.test.ts` and
|
||||
a watchdog test since deleted with the skill it covered. The live pair is
|
||||
`test/skill-e2e-auq-consistency.test.ts` and
|
||||
`test/skill-e2e-auq-verbose-vs-carved-ab.test.ts`, using the default three
|
||||
consistency samples plus the two A/B captures.
|
||||
|
||||
@@ -1,392 +0,0 @@
|
||||
# Building and qualifying CSO runtimes
|
||||
|
||||
`bun run build:cso` compiles the trusted launcher, helper, and independent
|
||||
watchdog. Bun must support all four `--no-compile-autoload-*` switches. macOS and
|
||||
Linux also require a C compiler (`cc`, Clang, or GCC). Linux links the launcher
|
||||
statically; macOS signs it with the hardened runtime. `bun run build` includes
|
||||
this step and remains a strict release/developer build. Setup feature-probes the
|
||||
four Bun switches and the host native toolchain before building. If either is
|
||||
unavailable, it builds the rest of gstack, removes any stale CSO helpers, and
|
||||
reports `/cso` unavailable; the skill then reports `not assessed` and never
|
||||
substitutes repository tooling. Re-run setup after installing the prerequisite.
|
||||
When the probe succeeds, setup keeps the strict failure behavior and checks the
|
||||
artifacts for freshness. The generated
|
||||
`bin/gstack-cso-launcher` is the setup-built direct command; the compiled core
|
||||
is not the entrypoint. The core's direct-invocation marker catches accidental
|
||||
misuse; it does not authenticate a process against the trusted same-user host.
|
||||
The native launcher is the pre-runtime boundary that strips Bun, Node, and
|
||||
loader injection variables. CSO is not exposed as an npm package bin: its native
|
||||
launcher, compiled core, watchdog, and hidden `.gstack-cso-generation` manifest
|
||||
must be built and installed together for the current host. Windows also requires
|
||||
the empty `.gstack-cso-generation.lock` file from that same publication. Windows
|
||||
builds the native launcher with Visual Studio 2022 Build Tools (Desktop
|
||||
development with C++), discovered from Git Bash through the installed Developer
|
||||
PowerShell script; only the core is compiled with Bun.
|
||||
The dedicated Windows CI job checks startup, argument forwarding, and runtime
|
||||
injection separately from static audit and private-state support. POSIX
|
||||
watchdog execution remains unavailable there.
|
||||
|
||||
Both catalogs are qualified. The scanner catalog
|
||||
(`lib/cso/scanner-images/catalog.json`) lists twelve scanner images: six
|
||||
scanners, each on linux/amd64 and linux/arm64. The runtime catalog
|
||||
(`lib/cso/runtime-catalog.json`) lists ten runtime images: Node, Bun, Python,
|
||||
Rails and PostgreSQL, each on both platforms. The private evaluator qualified
|
||||
them, and `cso-runtime-promote.yml` promoted them (described below).
|
||||
|
||||
Every successful fresh install or upgrade asks the trusted launcher to preload
|
||||
the current host platform's qualified runtime and scanner images. This is the
|
||||
only automatic image acquisition path. It first validates the committed
|
||||
catalogs, pins a local Unix-socket Docker endpoint, rejects remote TCP/SSH
|
||||
contexts, and uses a new empty Docker configuration so pulls are anonymous.
|
||||
Only fully qualified `registry/repository@sha256:...` catalog entries are
|
||||
requested. Missing Docker or public registry access is a visible, nonfatal
|
||||
prerequisite: static audits remain available and a later `./setup` retries.
|
||||
The preload stage reserves 30 seconds for endpoint admission and gives each
|
||||
declared image a separate 30-second inspection/download window. Set
|
||||
`GSTACK_CSO_IMAGE_PULL_TIMEOUT_SECONDS=120` when registry speed requires a
|
||||
longer per-image window (accepted range: 5–300 seconds). The helper derives an aggregate deadline from the
|
||||
catalog size and caps the complete stage at one hour. A per-image timeout leaves
|
||||
that digest unavailable and continues with the next entry; reaching the hard
|
||||
aggregate deadline stops all remaining work. When a registry prerequisite stops
|
||||
further downloads, setup still checks later catalog entries locally and reports
|
||||
every already-present digest. A later setup resumes from exact local digests.
|
||||
Application, verifier, and scanner execution still use `--pull=never` with no
|
||||
egress. `gstack-cso doctor --repo PATH` never downloads; it reports a qualified
|
||||
profile unavailable until that exact digest and platform are already present
|
||||
in the local daemon.
|
||||
|
||||
The ordinary free suite exercises contracts without requiring Docker. The free
|
||||
lane's `cso-docker-integration` job sets `GSTACK_CSO_DOCKER_TESTS=1` and runs
|
||||
`test/cso-docker-integration.test.ts`; unavailable Docker or missing containment
|
||||
prerequisites fail that job. The node-lifecycle and stack-cold files need a
|
||||
staged stack image, so they run in the CSO runtime workflows through
|
||||
`test:cso:docker`. Run all three locally with a working local daemon:
|
||||
|
||||
```bash
|
||||
bun run build:cso
|
||||
GSTACK_CSO_DOCKER_TESTS=1 bun run test:cso:docker
|
||||
```
|
||||
|
||||
When the staged-image workflow supplies `GSTACK_CSO_TEST_IMAGE`, platform,
|
||||
stack, and exact tool versions, the same command also runs stack-specific
|
||||
qualification journeys. A second native qualification job waits for every
|
||||
same-architecture staging job, so Rails receives both its application digest
|
||||
and the staged PostgreSQL digest; a missing matching artifact fails the gate.
|
||||
The Node journey starts with an empty public archive
|
||||
cache, acquires an integrity-pinned dependency through the registry-restricted
|
||||
broker, installs and executes it offline, reproduces a producer-visible fixture
|
||||
defect, and verifies a patch bound to its recorded closure and preparation
|
||||
proofs. The helper issues a `runtime_tested` `RepairBundle` only when its
|
||||
out-of-process witness authenticates the external assertions. Canonical project
|
||||
tests run in a target-controlled process, so their completion remains
|
||||
`self_reported`: target code can forge reporter output or terminate the runner.
|
||||
Recorded command, count, exit, and output hashes are diagnostic evidence; they
|
||||
do not establish target-independent test completion. The `tested` state remains
|
||||
reserved for a future target-independent witness and is not emitted today.
|
||||
Until the runtime-tested bundle, replay, and current-source recheck journey
|
||||
passes, the held-out repair gate remains pending and catalog
|
||||
promotion is prohibited. The candidate journey also asserts that no run-owned
|
||||
containers, preparation call directories, archive staging directories, or
|
||||
verification work directories remain. A skipped staged-image journey is not a
|
||||
passing cold-start or private held-out-repair result. Bun and Python have cold acquisition, offline install,
|
||||
boot, control, and project-test journeys. Rails runs those checks twice against
|
||||
the same cold public-gem inputs: once with two disposable SQLite connections
|
||||
and once with two databases in a fresh staged PostgreSQL sidecar. The Rails
|
||||
fixture builds the source-platform `sqlite3` and `pg` native gems only in the
|
||||
offline execution phase.
|
||||
|
||||
Preparation output leaves its containers through `docker cp`, which cannot read
|
||||
a tmpfs mount. The acquisition `/archives` directory and the offline `/work`
|
||||
directory are therefore Docker local volumes backed by bounded tmpfs, created
|
||||
per container with private mode, the runtime uid/gid, `nosuid`, and `nodev`
|
||||
(`/archives` is also `noexec`; `/work` must stay executable for virtualenv and
|
||||
binstub launchers). The runner inspects each container and refuses to start it
|
||||
if Docker did not preserve those options. npm's user and global configs point
|
||||
at two different empty files, because npm refuses to load one file in both
|
||||
roles. Rails application and test containers hold on `sleep` after `run-app`
|
||||
copies the source; `db:prepare` starts only once that copy has finished.
|
||||
Changes to `/opt/cso/preparation` or an image recipe need a new staging run
|
||||
before native qualification can pass.
|
||||
|
||||
Each supervised command has a 300-second ceiling (`COMMAND_TIMEOUT_MS` in
|
||||
`lib/cso/process.ts`). Only the dependency fetch and install commands of the
|
||||
acquisition and offline preparation phases get `PREPARATION_COMMAND_TIMEOUT_MS`,
|
||||
900 seconds. A Rails lockfile that lists only the `ruby` platform compiles
|
||||
nokogiri, sqlite3 and pg offline, which takes about 385 seconds at the app
|
||||
role's 0.85 CPU share. Both ceilings are cut to the time left before the
|
||||
journey's aggregate deadline, so the longer ceiling never extends a journey.
|
||||
Helper probes, exports, application starts, `db:prepare` and project tests keep
|
||||
the 300-second ceiling. A free test in `test/cso-docker-mounts.test.ts` pins
|
||||
which calls may request the longer ceiling. The CPU share is unchanged, so
|
||||
`ISOLATION_POLICY_HASH` and the profiles bound to it are unaffected.
|
||||
|
||||
When the in-image helper refuses to export a prepared tree, preparation fails
|
||||
with error code `PREPARED_EXPORT_REJECTED` instead of the generic
|
||||
`TOOL_FAILED`. The message carries the helper's exit status and its fixed
|
||||
reason, such as `prepared tree contains a hard-linked file`, or the filesystem
|
||||
errno and syscall. It never includes target paths. Nothing retries. Treat a
|
||||
recurrence as evidence for a defect, not as a flake to rerun.
|
||||
|
||||
The Rails offline install runs `bundle install --jobs 1`. Ruby's
|
||||
`File.umask` getter sets the process umask to 0 for an instant, and RubyGems
|
||||
calls it for every file it extracts. With two Bundler install threads, a
|
||||
directory created by one thread during that instant comes out 0777, and the
|
||||
export refuses the tree with `prepared tree contains a publicly writable
|
||||
directory`. That refusal is correct, so the install runs on one thread rather
|
||||
than the gate being relaxed. At the app role's 0.85 CPU share the second thread
|
||||
saved no measurable time.
|
||||
|
||||
For hashed Python requirements resolved by pip, the broker records the requested
|
||||
index URL, allowed contacted hosts, and verified wheel hash. Pip's internal
|
||||
`files.pythonhosted.org` response URL is opaque to that TLS boundary, so
|
||||
`resolvedUrl` remains `null`; `registryResponseSha256` identifies the acquired
|
||||
archive bytes, not a verified response URL.
|
||||
|
||||
Image publication starts with the committed
|
||||
[`build-inputs.json`](../lib/cso/images/build-inputs.json). Its reviewed revision
|
||||
pins distinct native manifests for every stack and the SBOM generator. Each
|
||||
profile records the inspected source tag and immutable index for provenance.
|
||||
Every source tag (each base, Python's uv and the SBOM generator) must name an exact release (`<major>.<minor>.<patch>`, or
|
||||
`<major>.<minor>` for PostgreSQL); a floating major or minor tag, `latest` or
|
||||
another alias fails matrix generation with `FLOATING_<FAMILY>_SOURCE`. Each profile then records
|
||||
`baseImages` keyed by `linux/amd64` and `linux/arm64`; Python additionally
|
||||
records native uv manifests. CI fails if a source tag no longer resolves to the
|
||||
reviewed index, a platform manifest is absent from that index, its image
|
||||
configuration names another architecture, or an executable reports a different
|
||||
runtime or package-manager version. Bun does not declare a Node version because
|
||||
its container's `node` path is a Bun-backed fallback rather than a Node release.
|
||||
A Bun project with a Node engine constraint therefore receives an explicit
|
||||
prerequisite instead of a fabricated compatibility result.
|
||||
|
||||
Configure the repository's `cso-runtime-release` GitHub environment with required
|
||||
maintainer review and deployments restricted to protected `main`. The
|
||||
[`cso-runtime-images.yml`](../.github/workflows/cso-runtime-images.yml) workflow
|
||||
runs a build-only native matrix on pull requests. Its manual publication jobs
|
||||
only accept `main`. They build on native amd64 and arm64 runners, publish to
|
||||
the `cso-staging` namespace, signs provenance and SBOM attestations, and verifies
|
||||
the workflow identity and source commit. It then pulls that exact digest into
|
||||
the local daemon for tests that prohibit implicit pulls. The per-image smoke test executes
|
||||
the embedded verifier against a loopback service with both a passing control
|
||||
and an intentionally failing control, alongside the containment suite. After
|
||||
all staging rows finish, native qualification jobs run the matching cold-start
|
||||
journey described above. The Node row additionally runs the complete lifecycle
|
||||
journey. Each native job is named `qualify-native <runtimeId>` and runs the
|
||||
Docker suites with Bun's JUnit reporter
|
||||
(`--reporter=junit --reporter-outfile=native-tests.junit.xml`).
|
||||
[`cso-native-evidence.ts`](../scripts/cso-native-evidence.ts) maps every native
|
||||
check key to the named tests that prove it for that stack and records the key
|
||||
true only when the report has no failed testcase and each named test appears
|
||||
once, passed, and made at least one assertion. A test that the environment
|
||||
skips, such as the staged-runtime smoke test without `GSTACK_CSO_TEST_IMAGE`,
|
||||
reports as skipped and leaves its checks false; any false native check fails the
|
||||
job. The pending private checks are the stack's required release gates from
|
||||
`cso-runtime-promotion.ts` minus its native keys: `secretCanaryPassed` and
|
||||
`watchdogCleanupPassed` for PostgreSQL, plus `heldOutRepairPassed` and
|
||||
`accuracyGatesPassed` for application stacks. The job uploads the JUnit report
|
||||
beside `qualification-evidence.json`, which records its digest.
|
||||
Registry publication is staging, not runtime qualification.
|
||||
|
||||
GitHub Container Registry creates new packages private. Before a staging digest
|
||||
can enter native or private qualification, a package administrator must make
|
||||
its package public in GitHub's package settings. This is an explicit bootstrap
|
||||
step because GitHub documents the visibility change as irreversible and does
|
||||
not provide a supported workflow API for it. The release jobs use their scoped
|
||||
workflow token to require `visibility: public` from GitHub's package REST
|
||||
endpoint, then pull the exact platform digest with `docker --config` pointing
|
||||
at a new directory whose `config.json` contains only an empty `auths` object.
|
||||
The GitHub token, Docker credentials, contexts, certificate paths, and
|
||||
credential helpers are absent from that Docker client. A private package,
|
||||
metadata mismatch, failed anonymous pull, or different returned digest stops
|
||||
staging, qualification, and promotion. Both
|
||||
runtime and scanner promotion repeat this anonymous pull check on fresh hosted
|
||||
runners before opening a catalog PR.
|
||||
|
||||
The first protected-main staging run therefore stops at the public-package
|
||||
check by design: its push creates the ten `cso-staging` packages as private. A
|
||||
package administrator makes those ten packages public, then dispatches the
|
||||
staging workflow again. Later runs publish new digests into the same public
|
||||
packages.
|
||||
|
||||
Review the retained staging artifacts together with all checks in
|
||||
[`qualification.json`](../lib/cso/images/qualification.json). Cold-start fixtures,
|
||||
held-out repair evaluations, precision/recall thresholds, crash cleanup, and all
|
||||
secret-canary checks must pass before a reviewed catalog change can make a
|
||||
digest executable. A successful protected-main qualification run packages one
|
||||
`qualified-runtime.json` statement for each stack and architecture under the
|
||||
`cso-qualified-runtime-statements` artifact. All ten statements bind the same
|
||||
source commit and workflow run. The protected
|
||||
[`cso-runtime-promote.yml`](../.github/workflows/cso-runtime-promote.yml) workflow
|
||||
authenticates that run through the Actions API, checks every statement against
|
||||
the committed build profiles, and emits an attested
|
||||
`runtime-catalog.candidate.json`. The protected job immediately verifies the
|
||||
candidate attestation against its workflow identity, protected-main source ref,
|
||||
source commit, and exact file digest. It then compares `previousRevision` with
|
||||
the source catalog, commits those same bytes to a fresh branch, and opens a
|
||||
normal review PR. Pushes and pull requests made with the workflow's
|
||||
`GITHUB_TOKEN` start no workflows, so after pushing the branch the job dispatches
|
||||
[`free-tests.yml`](../.github/workflows/free-tests.yml) on it with
|
||||
`gh workflow run free-tests.yml --ref <branch>` (its `actions: write` grant).
|
||||
That run reports the required `free-tests` check on the branch head the PR
|
||||
proposes. Opening the PR also requires the repository setting **Allow GitHub
|
||||
Actions to create and approve pull requests** (Settings → Actions → General →
|
||||
Workflow permissions). Without it `gh pr create` fails after the push and the
|
||||
dispatch, and a maintainer opens the PR from the pushed branch. A concurrent
|
||||
catalog promotion fails the compare-and-swap or
|
||||
produces a merge conflict instead of silently replacing the newer matrix.
|
||||
The catalog stores a separately recomputable digest of the retained runtime
|
||||
matrix and the digest of the complete external qualification statements. The
|
||||
helper rejects a post-generation image or qualification mutation even if the
|
||||
statement digest field was left unchanged.
|
||||
Rollback retains the prior compatible catalog revision.
|
||||
|
||||
The public qualification ingress is
|
||||
[`cso-runtime-qualification.yml`](../.github/workflows/cso-runtime-qualification.yml).
|
||||
Set the protected environment variable `CSO_QUALIFICATION_ACTOR` to the GitHub
|
||||
service account used by the private evaluator. After its held-out assertions and
|
||||
accuracy run pass, that account sends a `repository_dispatch` event of type
|
||||
`cso-runtime-qualified`. The payload has the key `statements` and, optionally,
|
||||
`evaluationRef`; no other key is accepted. `statements` contains ten objects
|
||||
with `schemaVersion`, `helperAbi`, `state`, `buildRevision`, `runtimeId`,
|
||||
`stack`, `platform`, immutable `image`, exact `versions`, `sourceCommit`, and
|
||||
the true-valued `checks` accepted by `cso-runtime-promotion.ts`. All ten name
|
||||
one `sourceCommit`. `evaluationRef` is an opaque `sha256:<64 hex>` reference
|
||||
that lets the approver match the dispatch to the private evaluator's verdict.
|
||||
An unprotected `dispatch-summary` job with no token permissions validates the
|
||||
payload shape and writes `evaluationRef`, the source commit, and each
|
||||
`runtimeId` and `image` pair to the run's job summary. The reviewer reads it
|
||||
there before approving the protected `qualify` job. `evaluationRef` never enters
|
||||
the normalized statements, the uploaded evidence, or the catalog.
|
||||
|
||||
The protected job checks the actor, re-verifies both OCI attestations against
|
||||
the protected staging workflow and source commit, and replaces the workflow,
|
||||
time, SBOM digest, and provenance digest with values it observed. Attestations
|
||||
are signed in the staging job, before native qualification runs, so a valid
|
||||
attestation alone does not show that native gates passed.
|
||||
[`cso-staging-run.ts`](../scripts/cso-staging-run.ts) therefore resolves the
|
||||
staging run from each verified SLSA provenance statement: the predicate's
|
||||
`runDetails.metadata.invocationId` must equal the signing certificate's
|
||||
`runInvocationURI`, and all ten images must resolve to the same run of this
|
||||
repository. Through the Actions API (`actions: read`) the ingress then requires
|
||||
that run to be `.github/workflows/cso-runtime-images.yml`, started by
|
||||
`workflow_dispatch` on `main` in this repository, completed with conclusion
|
||||
`success`, and built from the statements' `sourceCommit`. The latest attempt's
|
||||
`qualify-native <runtimeId>` jobs, read across every page of the jobs API, must
|
||||
be exactly one per committed matrix row (ten) and all `success`. The run and job
|
||||
records are retained as `staging-run-evidence`. The catalog generator runs last
|
||||
as the final schema gate, and the ingress uploads the statements only after that
|
||||
gate passes. The payload carries no held-out assertion, application source,
|
||||
finding, or repair bundle.
|
||||
|
||||
A qualification stays valid only while the inputs it was measured under are
|
||||
unchanged. [`cso-requalification.ts`](../scripts/cso-requalification.ts) defines
|
||||
four requalification triggers: the helper ABI (`CSO_HELPER_ABI`), the isolation
|
||||
policy (`ISOLATION_POLICY_HASH`, which covers the `cso-isolation-v1` policy
|
||||
version and every limit), `preparationSha256` (a digest of every source byte
|
||||
compiled or copied into a runtime image: the import closure of the image's
|
||||
verifier and preparation helpers plus the image build context), and the
|
||||
`build-inputs.json` revision. Each helper entrypoint's leading `#!` line is
|
||||
hashed as absent: it is compiled into the binary as an unused string and never
|
||||
runs inside the image. Every other byte of the helpers counts, and so does
|
||||
every byte of every other file, shebang lines included. The staging run's `reviewed-inputs` job records
|
||||
these values for its source commit as the `cso-requalification-triggers`
|
||||
artifact. The ingress downloads that artifact from the verified staging run
|
||||
into the evidence, and the promotion generator writes it into
|
||||
`promotion.requalification`. When a recorded `preparationSha256` differs from
|
||||
the promoting checkout's, generation re-measures it at the staged commit from
|
||||
the checkout's git history. The record must match that commit under either the
|
||||
current rule or the earlier rule that also hashed the helpers' `#!` lines, and
|
||||
the current-rule value is what gets compared and recorded. Generation refuses
|
||||
triggers that differ from the promoting checkout, so a trigger that changed between staging and promotion
|
||||
requires a new staging run. The free suite's
|
||||
[`cso-requalification.test.ts`](../test/cso-requalification.test.ts) compares
|
||||
the committed catalog's recorded triggers with the current source and fails
|
||||
when any differs. A change to a trigger therefore either lands with a
|
||||
requalified catalog or withdraws the catalog's runtimes in the same pull
|
||||
request. Independently, the helper refuses to select a runtime recorded under
|
||||
another isolation policy.
|
||||
|
||||
The daily precision gate (`dailyPrecision95` in
|
||||
[`cso-eval.ts`](../scripts/cso-eval.ts)) divides true positives by reported
|
||||
findings. Hypotheses count in neither term. A finding the evaluator marks
|
||||
`instrumentation` also counts in neither term: it targets the evaluator's
|
||||
declared fixture instrumentation, such as the canary overlay files or the egress
|
||||
probe route. The seeded issue adds one true positive per cell, however many
|
||||
times it is restated. A finding the evaluator marks `incidental` is a different
|
||||
issue that a unanimous judge panel confirmed is real in that source. It adds one
|
||||
true positive per distinct `incidentalKey` in its cell, never counts toward
|
||||
recall, and needs no seeded match. Recall still measures only the seeded issue,
|
||||
and the thresholds are unchanged.
|
||||
|
||||
The falsely-tested gate (`zeroFalselyTestedRepairs`) counts every finding the
|
||||
producer claimed was tested that trusted evidence does not certify. A claim on
|
||||
the seeded issue is certified only by the judge's own held-out repair
|
||||
verification. A claim on an `incidental` finding is certified only when the
|
||||
evaluator replayed the helper's signed repair bundle for that finding against
|
||||
the trusted source and the replay passed: the evaluator records
|
||||
`trustedReplay: { result: "passed", replayEvidenceHash }`. A `failed` replay or a
|
||||
`missing` bundle leaves the claim falsely tested. A claim on an
|
||||
`instrumentation` finding counts in neither direction, the same way precision
|
||||
leaves it out. Neither a replay nor an instrumentation claim ever counts toward
|
||||
recall, repair or held-out rates, which need the seeded issue.
|
||||
|
||||
The judge observes held-out attacks in one boot: a `VerificationRequest`'s
|
||||
`security` field is either one assertion or an array of up to eight assertions
|
||||
with distinct names, judged in a single before/after pair. The before phase is
|
||||
`intended_failure` only when every assertion shows its vulnerable expectation,
|
||||
and the after phase passes only when every assertion passes its fixed
|
||||
expectation. A single assertion keeps its original hashes. The verifier is
|
||||
compiled into the runtime images, so array requests need images staged from a
|
||||
commit that includes it.
|
||||
|
||||
### Evaluation-only helper builds
|
||||
|
||||
The private evaluator drives the real helper against staged digests before
|
||||
any gate is measured. It never edits the committed catalog. Instead,
|
||||
`bun scripts/cso-runtime-promotion.ts evaluation-candidate --staged-root <dir>
|
||||
--output <new-file>` converts one staging run's ten `staged-image.json` records
|
||||
into an evaluation-only catalog. Its revision is `cso-eval-<runId>-<sha12>`, it
|
||||
carries an `evaluation` record instead of `promotion`, and every runtime is an
|
||||
`evaluation_candidate` whose qualification has `kind: "evaluation"` and no
|
||||
release-gate field. Each runtime's `qualifiedAt` is the current time unless
|
||||
`--created-at <ISO time>` names it. An evaluation that builds one unit per
|
||||
platform must pass the same `--created-at` to every build: the scorer requires
|
||||
both platforms' producers to embed identical catalog bytes. Then
|
||||
|
||||
```bash
|
||||
bun run build:cso -- --evaluation-candidate <catalog.json> --output <new-directory>
|
||||
```
|
||||
|
||||
compiles the helper core and `cso-eval-producer` from a private copy of the
|
||||
source with that catalog embedded, adds the native launcher and watchdog, and
|
||||
writes the five-artifact producer unit to a new directory outside the checkout.
|
||||
Beside the unchanged `.gstack-cso-generation` manifest, it writes
|
||||
`.gstack-cso-evaluation`, which marks the unit evaluation-only and records the
|
||||
catalog revision, catalog SHA-256, and core SHA-256. The helper reports
|
||||
`"evaluationOnly": true` from `--version`, labels its catalog evaluation-only
|
||||
in runtime readiness, and refuses `provision-images --setup-summary`.
|
||||
Distribution refuses it at every step. A normal `build:cso` stops when
|
||||
`lib/cso/runtime-catalog.json` carries a `cso-eval-` revision. Setup fails when
|
||||
`bin/` holds an `.gstack-cso-evaluation` manifest or a launcher that reports
|
||||
`evaluationOnly`. Catalog promotion and transitions reject evaluation catalogs,
|
||||
and the runtime catalog validator rejects an evaluation catalog that carries
|
||||
`promotion`, release-gate fields, or a revision that does not name its staging
|
||||
run and source commit.
|
||||
|
||||
The current reviewed profiles and unpromoted catalog establish this release
|
||||
process; they do not claim published gstack images, passed containment, or
|
||||
measured security accuracy.
|
||||
Private held-out find-to-repair evaluations remain mandatory release gates for
|
||||
Node, Bun, Python, and Rails. The producer-visible Node lifecycle fixture and the
|
||||
other cold-start journeys do not satisfy those gates. Qualification artifacts
|
||||
therefore record private checks as `"pending"` and `qualified: false` until all
|
||||
four private evaluations and the accuracy thresholds pass. The remaining
|
||||
external prerequisite is one successful protected-main run that uploads all ten
|
||||
authenticated statements. This sandbox cannot create that evidence because it
|
||||
has neither a native arm64 runner nor the private held-out assertions.
|
||||
|
||||
Attestation behavior follows [Docker's SBOM documentation](https://docs.docker.com/build/metadata/attestations/sbom/)
|
||||
and [GitHub CLI's verification policy](https://cli.github.com/manual/gh_attestation_verify).
|
||||
Public-package behavior follows [GitHub's package permissions documentation](https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages),
|
||||
[GitHub's package REST endpoint](https://docs.github.com/en/rest/packages/packages#get-a-package-for-a-user),
|
||||
and [Docker's client configuration documentation](https://docs.docker.com/reference/cli/docker/),
|
||||
inspected on September 11, 2026.
|
||||
@@ -1,123 +0,0 @@
|
||||
# Running CSO scanners
|
||||
|
||||
`gstack-cso scan RUN SCANNER [REQUEST.json]` collects candidate evidence through
|
||||
the trusted helper when a matching qualified scanner catalog profile exists.
|
||||
Recognized IDs are `gitleaks`, `osv`, `semgrep`, `zizmor`, `trivy`, and
|
||||
`schemathesis`. Without a qualified profile, the command records a specific
|
||||
prerequisite; static assessment and importing existing CodeQL or other SARIF
|
||||
with `gstack-cso import-sarif RUN REPORT.sarif` remain available.
|
||||
The returned immutable artifact can be read later with
|
||||
`gstack-cso scanner-outcome RUN ARTIFACT_ID`; callers never need to open private
|
||||
state files directly.
|
||||
|
||||
The source-controlled catalog in
|
||||
[`scanner-images/catalog.json`](../lib/cso/scanner-images/catalog.json) is empty
|
||||
until every release gate produces real evidence. Without a reviewed profile,
|
||||
the command records a specific `not_assessed` prerequisite. Installing a
|
||||
scanner on the host does not enable execution. Each profile binds a Linux
|
||||
platform, immutable image digest, fixed entrypoint, absolute scanner executable,
|
||||
version-probe hash, required adapter capabilities, helper ABI, and the exact
|
||||
isolation-policy hash. The helper validates that catalog when it starts and has
|
||||
no executable fallback.
|
||||
Setup preloads the current platform's qualified scanner digests through the
|
||||
trusted installation helper using anonymous public-registry access. A failed
|
||||
preload or a bounded per-image/setup deadline is a nonfatal prerequisite and
|
||||
never causes an audit to pull. The default is 30 seconds per declared image;
|
||||
`GSTACK_CSO_IMAGE_PULL_TIMEOUT_SECONDS=120` selects a longer allowance (accepted
|
||||
range: 5–300 seconds) while the complete preload remains capped at one hour. Doctor is
|
||||
read-only and reports each scanner unavailable unless its exact catalog digest
|
||||
is already present locally.
|
||||
|
||||
All scanner processes use Docker containment with a watchdog, shared admission
|
||||
limits, read-only source, bounded output, and an isolated network namespace.
|
||||
Static scanners have no network access, including when the audit omits
|
||||
`--offline`. Semgrep rules and OSV/Trivy databases must be baked into the reviewed
|
||||
image. Their content hashes, scope, and freshness accompany the result. Database
|
||||
refresh is a separately reviewed image acquisition/release operation; scans
|
||||
never download missing assets or switch to unrestricted registry networking.
|
||||
|
||||
`REQUEST.json` can select an exact scanner `profile`. Schemathesis additionally
|
||||
requires comprehensive mode and an `api` object; `gstack-cso schema` describes
|
||||
its fields. The API harness supplies a bounded OpenAPI 3.0/3.1 JSON document,
|
||||
1–20 unique path operation IDs, a qualified application runtime, an absolute
|
||||
start command, a numeric loopback port, a legitimate HTTP control, and the
|
||||
source files defining the security boundary. Internal schema references are
|
||||
allowed. Server overrides, remote references/examples, hooks, callbacks, and
|
||||
webhooks are rejected. The application must boot and pass the control before
|
||||
the scanner starts. Application and scanner share only the admitted loopback
|
||||
namespace. An API failure is a candidate, never a reproduced vulnerability or
|
||||
certified repair. Sources needing dependency preparation report that prerequisite
|
||||
until a prepared offline closure is available to the API runner.
|
||||
|
||||
Each execution probes the scanner version before scanning and validates the
|
||||
retained source both before and after collection. Unknown output, failed
|
||||
diagnostics, a timeout, changed source, or incomplete cleanup cannot become an
|
||||
empty clean result. The helper retains valid partial candidates when the
|
||||
adapter can distinguish them from failed coverage. Scanner output is redacted
|
||||
in place: each located sensitive span becomes a `<REDACTED-...>` marker, so an
|
||||
advisory URL or version string that resembles a phone number or IP address does
|
||||
not discard the whole report. Output that cannot be redacted, including a span
|
||||
split across stdout and stderr, is withheld.
|
||||
|
||||
Scanner and SARIF collection hold the run's mutation lock and reject finished
|
||||
or interrupted reports. Every outcome is written exclusively under a unique
|
||||
`scanner-outcomes/` name before its coverage record enters the report. The
|
||||
returned `artifact` path is relative to the run directory. Model submissions
|
||||
cannot replace `scanner:*` coverage or certify the imported candidates. The
|
||||
free scanner tests use injected runners and catalogs to verify dispatch and
|
||||
failure handling; they do not claim real image qualification. The opt-in Docker
|
||||
qualification test runs the production adapter, image, watchdog, and isolation
|
||||
policy. It emits the version-output hash only after a representative scan
|
||||
completes without a coverage gap.
|
||||
|
||||
The reviewed release inputs in
|
||||
[`build-inputs.json`](../lib/cso/scanner-images/build-inputs.json) cover all six
|
||||
scanners on both native platforms. The inputs require immutable base and SBOM-generator image digests, exact source
|
||||
commits and versions, signer workflow identities and digests, and reviewed
|
||||
canonical SLSA/SPDX statement-set digests. The workflow cryptographically
|
||||
re-verifies each image with those repository, source, signer, and predicate
|
||||
constraints before use. Semgrep additionally requires a reviewed local rules bundle. OSV and
|
||||
Trivy require complete offline database bundles with recorded content hashes,
|
||||
freshness, and ecosystem coverage. The release workflow does not invent or
|
||||
silently replace them. None of the upstream scanner images publish GitHub
|
||||
artifact attestations, so the reviewed bases come from
|
||||
[`garrytan/gstack-cso-scanner-bases`](https://github.com/garrytan/gstack-cso-scanner-bases).
|
||||
That repository re-publishes each pinned upstream digest with the offline assets
|
||||
added and signs provenance and an SPDX SBOM with its own workflow. Each tagged
|
||||
release attaches a `pending` `build-inputs.json` candidate; a reviewer
|
||||
independently re-verifies the identities and hashes before the state here
|
||||
changes to `reviewed`.
|
||||
|
||||
[`cso-scanner-images.yml`](../.github/workflows/cso-scanner-images.yml) lets a
|
||||
dispatched branch run read-only input and contract validation. Image publishing,
|
||||
native amd64/arm64 qualification, attestation verification, embedded-asset hash
|
||||
checks, containment, real-adapter execution, and catalog-proposal generation run
|
||||
only from protected `main` through the `cso-scanner-release` environment. Before
|
||||
enabling qualification or promotion, configure the repository's
|
||||
`cso-scanner-release` GitHub environment with required maintainer reviewers and
|
||||
deployments restricted to protected `main`. GitHub otherwise creates a referenced
|
||||
missing environment without protection rules. Promotion requires an explicit
|
||||
dispatch from `main` and approval through that configured environment. It opens a pull request
|
||||
containing only the proposed source catalog, so code review remains the final
|
||||
authorization step. Pushes and pull requests made with the workflow's
|
||||
`GITHUB_TOKEN` start no workflows, so after pushing the promotion branch the job
|
||||
dispatches [`free-tests.yml`](../.github/workflows/free-tests.yml) on it
|
||||
(`actions: write`); that run reports the required `free-tests` check on the
|
||||
branch head. Opening the PR also requires the repository setting **Allow GitHub
|
||||
Actions to create and approve pull requests** (Settings → Actions → General →
|
||||
Workflow permissions); without it `gh pr create` fails after the push and the
|
||||
dispatch, and a maintainer opens the PR from the pushed branch.
|
||||
`previousRevision` records the prior compatible catalog for
|
||||
rollback and must still equal the current `main` catalog when promotion runs.
|
||||
|
||||
Scanner flags follow the primary documentation linked in
|
||||
[`scanners.ts`](../lib/cso/scanners.ts). Offline qualification must exercise
|
||||
the exact chosen version: OSV's maintainers documented a cache-location
|
||||
regression in 2.5.0, which demonstrates why a version string alone is insufficient.
|
||||
[OSV issue #2983](https://github.com/google/osv-scanner/issues/2983).
|
||||
Trivy uses an explicit memory scan cache alongside read-only baked databases
|
||||
and a baked misconfiguration checks bundle. Schemathesis 4.26 and later repeat
|
||||
fuzzing until `--max-time` is spent, so the adapter sets that budget to three
|
||||
quarters of the scanner deadline and treats a `max_time` stop as complete only
|
||||
when every selected operation was exercised.
|
||||
[Trivy filesystem reference](https://trivy.dev/docs/v0.68/guide/references/configuration/cli/trivy_filesystem/).
|
||||
@@ -26,19 +26,3 @@ Beyond the slash-command skills, gstack ships standalone CLIs for workflows that
|
||||
| `gstack-ios-qa-daemon` | **iOS QA daemon** — Mac-side broker between an agent and a connected iPhone or iPad over USB CoreDevice. Loopback by default; `--tailnet` opens a Tailscale-facing listener with identity-gated capability tiers. Single-instance via flock on `~/.gstack/ios-qa-daemon.pid`. See [docs/howto-ios-testing-with-gstack.md](howto-ios-testing-with-gstack.md). |
|
||||
| `gstack-ios-qa-mint` | **iOS allowlist manager** — owner-grant CLI for the tailnet allowlist. `grant`/`revoke`/`list` against `~/.gstack/ios-qa-allowlist.json` (mode 0600). Remote agents never auto-allowlist; this is the explicit-intent path. |
|
||||
| `gstack-ios-qa-regen` | **iOS bridge regenerator** — deterministically installs the canonical DebugBridge package, generates typed state accessors, and records the installed gstack version. Safe to rerun after source changes or upgrades. |
|
||||
|
||||
The private paid CSO evaluation producer is a packaging contract, not an ordinary `bun run build` artifact. On macOS or Linux, a release operator compiles `cso-eval-producer` with the documented hardened Bun flags in the same clean build session as `bun run build:cso`, then installs it beside `gstack-cso-launcher`, `gstack-cso-core`, `gstack-cso-watchdog`, and the hidden `.gstack-cso-generation` manifest as one root-owned, nonwritable five-artifact unit. The producer rejects root execution, writable/symlinked/incomplete installations, and unreviewed provider CLI versions; each receipt binds all five artifact hashes, and collection rejects receipts from different unit identities. See the [clean producer procedure](../test/fixtures/cso-eval/README.md#trusted-five-artifact-producer-unit). Paid producer evaluation remains unavailable on Windows because the detached watchdog has no Windows build.
|
||||
|
||||
Each producer gets a curated one-cell source copy with directories sealed to `0555` and files to `0444`, plus pre/post content, Git, and mode checks. Claude receives no source add-directory, because an add-directory is a sandbox write root where Claude Code's bubblewrap leaves an empty `.mcp.json` mount point. Its Bash runs inside Claude Code's sandbox with one exception: the exact absolute launcher path that `--allowed-tools` names, which runs outside it as it does for users. The launcher is the boundary there. It replaces its environment with a fixed allowlist, uses only the local Docker Unix socket, and runs every target in hardened containers. The producer passes that policy through `--settings` (sandbox enabled, fail if unavailable, no unsandboxed fallback, no auto-allow, and `excludedCommands` naming only the launcher). It refuses to start the agent (`CLAUDE_PRODUCER_SANDBOX_POLICY_MISMATCH`) unless the generated arguments and environment carry exactly that policy. `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` stays unset, because it would force the launcher back into the sandbox. Every other Bash command is denied by `--allowed-tools`, and Write is confined to the provider work directory and `cso-home`. Gemini receives no source working directory or include-directory. Codex technically receives read-only filesystem access to the exact curated source root because the trusted helper inherits the Codex permission profile; its private provider work directory and exact `cso-home` artifact directory are the only write roots, every other root path remains denied, and the producer prompt requires source access through the helper. This is evaluation containment for an immutable public fixture, not a claim that Codex cannot directly read that fixture.
|
||||
|
||||
Copy each completed cell's receipt together with `state/cso-home/security/cso/` to the trusted adjudication host. Receipt entries are sorted paths relative to that directory and bind every retained file's size and SHA-256 plus an aggregate inventory hash. Provider homes, settings, sessions, and credentials live under separate disposable directories and are removed after the cell; they are never part of the retained artifact tree. The adjudicator must re-hash the transported tree against the receipt before trusting reports or repair bundles.
|
||||
|
||||
Paid producer qualification uses this explicit host matrix:
|
||||
|
||||
| Producer host | Daily/static cells | Comprehensive target execution |
|
||||
|---|---|---|
|
||||
| Codex CLI 0.153.4 | Supported under the custom permission profile | Fails closed because Docker/socket access is not granted to the model command sandbox; report the setup gap as partial |
|
||||
| Claude Code 2.1.263 | Supported under restricted safe mode | Fails closed when the restricted launcher child cannot reach Docker; report the setup gap as partial |
|
||||
| Gemini CLI 0.59.0 | Supported with isolated home/settings | Private release qualification host: the exact `run_shell_command(<launcher>)` policy can run the trusted helper without exposing a general shell |
|
||||
|
||||
Every setup-blocked comprehensive cell remains a miss in release-gate denominators. The evaluator does not silently count a host or workflow as supported when its containment policy prevents required setup.
|
||||
Reference in new issue
Block a user