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>
54 lines
1.2 KiB
Python
54 lines
1.2 KiB
Python
"""Typed errors with stable exit codes for the CLI.
|
|
|
|
Exit codes are part of the contract so callers (ops-warden, CI) can branch on
|
|
outcome without parsing text.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
|
|
class SecretsEngineError(Exception):
|
|
"""Base class. ``exit_code`` is the process exit status."""
|
|
|
|
exit_code = 1
|
|
|
|
|
|
class CatalogError(SecretsEngineError):
|
|
"""Catalog file missing, unparseable, or schema-invalid."""
|
|
|
|
exit_code = 2
|
|
|
|
|
|
class DecisionError(SecretsEngineError):
|
|
"""Decision/CCR missing, denied, superseded, stale, or unapproved."""
|
|
|
|
exit_code = 3
|
|
|
|
|
|
class PolicyGuardError(SecretsEngineError):
|
|
"""A plan violates a safety guard (wildcard, out-of-stage path, root, ...)."""
|
|
|
|
exit_code = 4
|
|
|
|
|
|
class BackendError(SecretsEngineError):
|
|
"""OpenBao backend call failed or is unreachable."""
|
|
|
|
exit_code = 5
|
|
|
|
|
|
class ProvisioningError(SecretsEngineError):
|
|
"""Provisioning input invalid (bad file mode, inside repo, missing field)."""
|
|
|
|
exit_code = 6
|
|
|
|
|
|
class VerificationError(SecretsEngineError):
|
|
"""A verification check did not produce the expected result."""
|
|
|
|
exit_code = 7
|
|
|
|
|
|
class DeliveryError(SecretsEngineError):
|
|
"""Exec-time delivery could not be set up safely."""
|
|
|
|
exit_code = 8
|