Skip to content

Isolate PCR signing behind a dedicated SecretSpec boundary - #912

Merged
AnthonyRonning merged 4 commits into
masterfrom
droid/opensecret-secret-boundaries
Sep 13, 2026
Merged

AnthonyRonning merged 4 commits into
masterfrom
droid/opensecret-secret-boundaries

Conversation

@AnthonyRonning

Copy link
Copy Markdown
Contributor

Problem

PCR approval signing shared the backend's general credential surface:

  • EIF build recipes ran with the full operator environment, so ambient cloud/provider/BWS variables could flow into builds.
  • The append-signing recipes resolved the signing key in the recipe process itself, created missing history files implicitly, and suggested key generation on lookup failure.
  • Deployment had no way to verify it received the exact reviewed artifact; any rebuild at deploy time could silently diverge from the signed measurements.
  • pcr_sign.js echoed raw errors that could carry key material into logs.

Approach

Keep the existing tools (Just, pcr_sign.js, scripts/pcr_compatibility.py) and pin native SecretSpec commands instead of adding a custom secret framework. One shared SDK-trusted signing key stays; only its resolution boundary changes.

What changes

  • secretspec/pcr-signing.toml (new): a separate manifest declaring only SIGNING_PRIVATE_KEY under a signing scope and an opensecret_pcr_signing user-level provider alias. The root secretspec.toml local-runtime contract is untouched.
  • Justfile:
    • build-eif-{dev,prod,preview} run under operator_env (env -i with a minimal tool/keyring allowlist), so builds never see credentials.
    • _append-pcr-file validates the PCR and history files first, skips already-approved measurements without any key lookup, and resolves the key via secretspec run only around node pcr_sign.js sign-pcr0. The parent recipe never receives the key.
    • New pcr-signing-check / pcr-signing-login recipes; diesel dev/prod migrations pass the URL via DATABASE_URL env instead of argv; SCP recipes take an explicit EIF path argument with quoted SSH variables.
  • scripts/pcr_compatibility.py:
    • append-signature subcommand: validates inputs, accepts only a public signature on stdin, verifies it against the pinned SDK public key, and atomically rewrites history. Missing or symlinked files are errors, never recreated.
    • artifact subcommand: read-only handoff verifier, checking a clean checkout at the reviewed commit, signed approvals, measurement match, EIF SHA-256, and Nix store immutability. Deployment consumes this instead of rebuilding.
  • pcr_sign.js: validates PCR0 format, deletes the env key after reading, and sanitizes error output so no key material can surface.
  • Flake: nodejs added to the dev shell; new operator-boundaries check runs the offline fixtures in the Nix sandbox.
  • Docs: secretspec/README.md documents the one-time BWS UI import (never CLI argv writes), the dedicated machine account, the authorized signing flow, and the deployment handoff; docs/pcr-compatibility.md, docs/nitro-deploy.md, and AGENTS.md point at it.

Validation

  • 32 script unittests pass in the pinned dev shell, including 5 new operator-boundary tests (native signing resolution with a replayed public signature, missing-key fail-closed, wrong-key rejection without history change, credential-free builds, manifest separation).
  • checks.aarch64-linux.operator-boundaries and the root checks.aarch64-linux.pcr-compatibility pass in the Nix sandbox.
  • All fixtures use isolated HOME/config directories, dummy dotenv providers, and synthetic keys; no real BWS access, signing key, EIF build, publication, or deployment occurred.

Explicitly out of scope

BWS project/machine-account creation, real value import, keyring logins, actual signing, PCR publication, and any deployment. These remain separate authorized operator steps documented in secretspec/README.md.

AnthonyRonning and others added 4 commits September 13, 2026 01:23
Separate the privileged signing path from local runtime and deployment:
a single-key secretspec/pcr-signing.toml manifest resolved only around the
signer, credential-stripped EIF builds, public-signature-only verified
history appends, an immutable-artifact handoff verifier, and a hardened
pcr_sign.js. Adds offline operator-boundary fixtures and an
operator-boundaries Nix check. No keys, signing, publication, or
deployment are performed by this change.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Chain the operator recipes through Just dependencies instead of nested
`just --no-dotenv` calls, drop the unused `label` parameter and the
redundant secretspec check before `run` (run already fails closed), and
pass optional environment variables through `env -i` only when set so an
empty DBUS/TMPDIR value cannot break keyring or temp-file access. Quote
the preview SSH/SCP recipes and pass the preview database URL via the
environment like dev/prod. Require the services/opensecret component path
in the artifact verifier, resolve the test temp dir so the artifact tests
pass on macOS, and document the keyring bus and python3/cryptography
requirements.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Follow SecretSpec's own layout: the manifests commit `[providers]` aliases
with the project IDs and a keyring credential, so per-machine setup is one
`login` instead of `provider add` plus `login`. The local-dev manifest also
declares a credential-free `opensecret_local_headless` twin; VMs and
containers without a keyring export BWS_ACCESS_TOKEN and
SECRETSPEC_PROVIDER=opensecret_local_headless. The local recipes therefore
pass those two variables through and stop pinning --provider, and the inner
service recipes drop the token before exec. Signing keeps the empty
environment and a keyring-only alias. Fixtures patch their copied manifest
to a dotenv URI, and the manifest test pins the committed IDs.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
`OpenSecret EIF release` is manual dispatch only. Its build job runs on the
trusted ARM64 runner, uploads image.eif/pcr.json with SHA256SUMS and a
handoff.json as an attested artifact, and reports whether the approved
snapshot already covers the measurements. With dry_run unchecked, the sign
job waits for the protected pcr-signing environment, resolves the existing
key through Bitwarden's Secrets Manager action into a single masked step
output, runs the same append-pcr-<env> recipe operators use (through a new
`pcr_signer` override, so the key still reaches only the node signer and
the verified atomic append is unchanged), and pushes an approval branch
for an ordinary pull request. It never creates a GitHub Release or tag; a
release-gate invariant and a workflow test class enforce that, along with
pinned actions, read-only build permissions and single-step key exposure.
The component flake gains a minimal `signing` dev shell and
`scripts/ci_sign_pcr.sh`; the root check gets jq for the new script tests.
Docs describe the flow, the one-time environment setup, and the deployment
handoff from a run's artifact. Legacy mirror publication and deployment
stay manual.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Maple development preview: https://9b06142f.maple-ca8.pages.dev

Commit: 64ae6d70f9529747c0b3129470ac2715ac398050

Uses development API, billing, flags and PCR configuration. Cloudflare Access applies.

@AnthonyRonning
AnthonyRonning marked this pull request as ready for review September 13, 2026 19:44
@AnthonyRonning
AnthonyRonning merged commit 54386a0 into master Sep 13, 2026
35 checks passed
@AnthonyRonning
AnthonyRonning deleted the droid/opensecret-secret-boundaries branch September 13, 2026 19:45

This branch was successfully deployed

1 active deployment
pages-pr-912 — 64ae6d70 Deployed Sep 13, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant