Load pep-stance.yaml as the live unreachable-engine gate and record named stance fields on privileged evidence. Classify evidence, queue load-bearing records in a local outbox, and add heartbeat/drain commands that never sit on a mutation path. Publish proposed SSH-CA and secret-use evidence contracts without adding an OpenBao SSH-CA write. T02 (access-engine decision records) and T06 (no standing credential) stay wait on external endpoints. Assistant: grok Assistant-Session: 01a04cea-cb33-7c63-bad7-c1b0f9f0076b
58 lines
1.4 KiB
Python
58 lines
1.4 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
|
|
|
|
def __init__(self, message: str, *, stance: dict[str, object] | None = None):
|
|
super().__init__(message)
|
|
self.stance = dict(stance or {})
|
|
|
|
|
|
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
|