feat(mvp): working secrets-engine CLI for the whynot-design npm publish lane

Implements SECRETS-WP-0002 end to end as a uv-managed Python package:

- catalog: non-secret lane registry + strict validator (build/test/prod)
- stage roles + OpenBao ACL policies; guards refuse wildcards, sys/, identity/,
  admin names, and cross-stage paths before any backend call
- plan/apply: dry-run-first, idempotent policy + approle apply, decision-gated
- decisions: State Hub lookup with local-fixture fallback; non-secret evidence
  to JSONL + hub progress, scrubbed of any value
- provision/verify: mode-0600 file import + generated test values; positive/
  negative checks that never print the value
- exec delivery: `exec --catalog ... -- npm publish` injects the token via a
  temp .npmrc for the child only, cleaned up on exit/failure/interrupt
- ops-warden routing contract + hardening backlog docs
- 34 tests incl. live OpenBao integration; scripts/demo-e2e.sh runs the full
  chain against a throwaway bao dev server

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-06-28 12:28:45 +02:00
parent 58c24cff53
commit a852d3f1ff
47 changed files with 3743 additions and 122 deletions

View file

@ -0,0 +1,36 @@
# secrets-engine-build build/dev stage role policy.
#
# Scope: manage approved BUILD-stage metadata and values under the build/ prefix
# only. May generate throwaway test values. Cannot touch test/ or prod paths,
# cannot administer sys/, auth/, or identity/, cannot act as root.
# KV v2 data + metadata under the build prefix.
path "secret/data/build/*" {
capabilities = ["create", "read", "update", "delete"]
}
path "secret/metadata/build/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
# Manage only the build consumer policies this role owns.
path "sys/policies/acl/se-build-*" {
capabilities = ["create", "read", "update", "delete"]
}
# Manage build approle roles only.
path "auth/approle/role/se-build-*" {
capabilities = ["create", "read", "update", "delete"]
}
path "auth/approle/role/se-build-*/role-id" {
capabilities = ["read"]
}
path "auth/approle/role/se-build-*/secret-id" {
capabilities = ["create", "update"]
}
# DENY everything outside the build lane (explicit, for reviewer clarity).
path "secret/data/test/*" { capabilities = ["deny"] }
path "secret/data/prod/*" { capabilities = ["deny"] }
path "sys/*" { capabilities = ["deny"] }
path "auth/token/*" { capabilities = ["deny"] }
path "identity/*" { capabilities = ["deny"] }

View file

@ -0,0 +1,47 @@
# secrets-engine-prod production stage role policy.
#
# Scope: apply approved PRODUCTION metadata (ACL policies + approle roles) and
# write approved lane values for provisioning. Deliberately NARROW:
# - no root / sudo
# - no sys/* administration beyond its own se-prod-* ACL policies
# - no identity/* administration
# - no auth/token administration
# - cannot reach into build/ or test/ prefixes
#
# Production raw-value READ stays gated: this role can write a value during an
# approved provisioning step, but broad read of arbitrary prod paths is denied.
# Consumers read their own lane through the narrow se-prod-<lane> consumer policy.
# Apply approved production lane values (provisioning) and metadata.
# Owner-scoped prod lanes (e.g. whynot-design/...) NOT under build/ or test/.
path "secret/data/+/*" {
capabilities = ["create", "update"]
}
path "secret/metadata/+/*" {
capabilities = ["create", "read", "update", "list"]
}
# Manage only the prod consumer policies this role owns.
path "sys/policies/acl/se-prod-*" {
capabilities = ["create", "read", "update", "delete"]
}
# Manage prod approle roles only.
path "auth/approle/role/se-prod-*" {
capabilities = ["create", "read", "update", "delete"]
}
path "auth/approle/role/se-prod-*/role-id" {
capabilities = ["read"]
}
path "auth/approle/role/se-prod-*/secret-id" {
capabilities = ["create", "update"]
}
# Hard denials production appliers must not become broad admins.
path "secret/data/build/*" { capabilities = ["deny"] }
path "secret/data/test/*" { capabilities = ["deny"] }
path "sys/policies/acl/secrets-engine-*" { capabilities = ["deny"] } # can't edit stage roles
path "auth/token/*" { capabilities = ["deny"] }
path "identity/*" { capabilities = ["deny"] }
path "sys/auth/*" { capabilities = ["deny"] }
path "sys/mounts/*" { capabilities = ["deny"] }

View file

@ -0,0 +1,33 @@
# secrets-engine-test test/staging stage role policy.
#
# Scope: manage approved TEST-stage metadata and values under the test/ prefix,
# and run positive/negative verification. Cannot touch build/ or prod paths,
# cannot administer sys/, auth/, or identity/, cannot act as root.
path "secret/data/test/*" {
capabilities = ["create", "read", "update", "delete"]
}
path "secret/metadata/test/*" {
capabilities = ["create", "read", "update", "delete", "list"]
}
path "sys/policies/acl/se-test-*" {
capabilities = ["create", "read", "update", "delete"]
}
path "auth/approle/role/se-test-*" {
capabilities = ["create", "read", "update", "delete"]
}
path "auth/approle/role/se-test-*/role-id" {
capabilities = ["read"]
}
path "auth/approle/role/se-test-*/secret-id" {
capabilities = ["create", "update"]
}
# DENY everything outside the test lane.
path "secret/data/build/*" { capabilities = ["deny"] }
path "secret/data/prod/*" { capabilities = ["deny"] }
path "sys/*" { capabilities = ["deny"] }
path "auth/token/*" { capabilities = ["deny"] }
path "identity/*" { capabilities = ["deny"] }