24 KiB
Enterprise Readiness Design and Implementation Plan
Goal Description
Archie is moving into a single static binary (cmd/archie) backed by PostgreSQL. Several core governance controls already exist. These include pre-action Cedar judgement, earned autonomy, and fresh WebAuthn passkey checks for irreversible actions. They also include Ed25519-signed extension catalogues, Linux namespace egress confinement, a DDL/DML database role split, and an external deletion ledger that survives database restores.
This plan sets out the architecture and phased work to deploy cmd/archie in regulated enterprise environments. It targets finance, healthcare, government, and critical infrastructure aligned with SOC 2 Type II, ISO 27001, SOX ITGC, PCI-DSS, and APRA CPS 234. It covers multi-stage containerised environments across dev, staging, and prod.
All work targets the single-binary architecture (cmd/archie, internal/app/archie, modules/*, and internal/platform/*), not the legacy six-service stack.
Key Architectural Decisions (User Review Required)
Important
1. Hard isolation per Archie stage (
dev/staging/prod) Each stage runs an isolated Archie instance with its own PostgreSQL database, sealing key, OIDC client, egress allow-list, and approval history. Earned autonomy in Staging must never carry over to Production. A single Production Archie instance can still govern multiple target tiers (such as non-prod and prod servers) using CMDB facts and Cedar policies.
Warning
2. Nested user namespaces (
CLONE_NEWUSER) conflict with hardened Kubernetes clustersmodules/connectors/internal/host/confine_linux.goruns every extension and stdio MCP server inCLONE_NEWUSER | CLONE_NEWNETwith no fallback. KubernetesrestrictedPod Security Standards,RuntimeDefaultseccomp, OpenShift security constraints, and Ubuntu or RHEL unprivileged-userns AppArmor profiles block this. Proposed approach: Support a documentedLocalhostseccomp profile for standard Kubernetes or Compose. Also add a pluggable remote or sidecar gRPC extension runtime (Track 5). Strict clusters can then isolate extensions as separaterestrictedPods governed by KubernetesNetworkPolicy.
Warning
3. FIPS 140-3 and cryptographic sealing (
agevs KMS envelope encryption)internal/platform/seal/seal.gousesage(X25519 + ChaCha20-Poly1305), which is not FIPS 140-3 validated. Regulated buyers often require FIPS-validated AES-256-GCM with KMS or HSM envelope encryption and periodic key rotation (archie rekey). Track 2 introduces a pluggableseal.Sealerthat keepsageas the default while enabling KMS or Vault Transit and FIPS builds.
Caution
4. Control-plane mutability vs GitOps change control
PRODUCT.mdmakes the dashboard the complete control plane, while regulated enterprises require peer-reviewed promotion from Staging to Production. Track 6 bridges this with versioned promotion bundles (export,diff, andapplywith an approval gate) rather than replacing the control plane with static YAML.
Open Questions
Confirm your choice on these five decisions before starting work:
- Target orchestrator: Should the deployment kit target Kubernetes (Helm and Kustomize) first with hardened Compose secondary, or both equally?
- FIPS 140-3 timing: Is
GOFIPS140with AES-256-GCM and KMS envelope encryption needed in v1? Or shouldage,archie rekey, and a Vault/OpenBao engine ship first? - Strict Kubernetes extension runner: Should the remote or sidecar gRPC extension runtime ship in v1? Or should it wait until a cluster blocks
Localhostseccomp? - Identity lifecycle: Should OIDC confidential client and group claim mapping ship first, or include SCIM 2.0 provisioning in the same milestone?
- High availability timing: Is Active-Passive (one active replica plus HA PostgreSQL) enough for v1, leaving Active-Active HA (
LISTEN/NOTIFYhub and leased pollers) for v2?
Target Architecture
Multi-Stage Regulated Deployment Topology
flowchart LR
subgraph CI["Release and Supply Chain (Signed OCI + SBOM)"]
IMG["archie OCI image\n(digest-pinned, cosign)"]
CAT["Internal Extension Catalogue\n(Ed25519-signed, OCI mirror)"]
BND["Promotion Bundle\n(workflows, Cedar, guards, pins)"]
end
subgraph DEV["Dev Stage (Isolated)"]
D_ARC["archie (dev)"]
D_DB[("PostgreSQL (dev)")]
D_KMS["KMS / Vault (dev)"]
D_ARC --> D_DB
D_ARC --> D_KMS
end
subgraph STG["Staging Stage (Isolated)"]
S_ARC["archie (staging)"]
S_DB[("PostgreSQL (staging)")]
S_KMS["KMS / Vault (staging)"]
S_ARC --> S_DB
S_ARC --> S_KMS
end
subgraph PRD["Production Stage (Regulated)"]
P_MIG["Pre-upgrade Job:\narchie migrate (owner_url)"]
P_ARC["archie (prod)\n(runtime url only)"]
P_DB[("HA PostgreSQL\nTLS verify-full")]
P_KMS["KMS / HSM / Vault (prod)"]
P_WORM[("WORM Object Store\nAudit + Deletion Ledger")]
P_SIEM["Enterprise SIEM\n(OTLP / Syslog / S3)"]
P_ITSM["ITSM Change Control\n(ServiceNow / Jira)"]
P_MIG --> P_DB
P_ARC --> P_DB
P_ARC --> P_KMS
P_ARC --> P_WORM
P_ARC --> P_SIEM
P_ARC --> P_ITSM
end
IMG -->|GitOps PR| DEV
IMG -->|Verified digest| STG
IMG -->|Approved CR| PRD
CAT --> DEV & STG & PRD
BND -->|Export + Diff| STG
BND -->|Peer Review + Approval Gate| PRD
Production Pod and Network Boundary
flowchart TD
EXT_SRC["External Alert/Webhook Sources"] -->|TLS + HMAC| EDGE_ING["Perimeter Webhook Ingress\n(/webhooks/* only)"]
OPS["Operators / Approvers"] -->|Corporate VPN / SSO| INT_ING["Internal Ingress\n(Dashboard + /api/* + OIDC)"]
subgraph NS["Kubernetes Namespace: archie-prod"]
EDGE_ING --> POD["archie Pod (nonroot UID 65532, RO root filesystem)"]
INT_ING --> POD
POD -->|Unix socket / remote mTLS gRPC| EXT["Confined Extensions\n(Allow-list Egress)"]
EXT -->|Chained via corporate proxy| PROXY["Corporate Egress Proxy / DLP"]
POD -->|TLS verify-full, DML role only| PG[("Managed HA Postgres")]
POD -->|RWO PVC or WORM backend| STATE[("state_dir / Deletion Ledger")]
end
Current-State Baseline vs Regulated-Enterprise Gap Matrix
| Control Domain | Already Built in cmd/archie |
Regulated-Enterprise Gap | Track |
|---|---|---|---|
| Container Packaging | Static CGO_ENABLED=0 binary + embedded SPA; host bind-mount in deployments/archie/compose.yml and deployments/archie/deploy.sh. |
No production Dockerfile for cmd/archie, no signed OCI image, and no SBOM or SLSA provenance. |
1 & 5 |
| DB Least Privilege | Strict owner_url (DDL) vs url (DML) split in internal/platform/pg/pg.go. |
Serving container still requires owner_url (internal/app/archie/config.go). Session advisory lock (ClaimServe) breaks PgBouncer transaction pooling. |
1 |
| Bootstrap & Config | Minimal config.toml + interactive setup gate (internal/app/archie/gate.go). |
WriteAdminHash mutates config.toml in place (breaks RO mounts). Secrets sit inline in config.toml. /readyz fails before setup, and no headless bootstrap exists. |
1 |
| Corporate Network | Allow-list egress tunnel + SSRF/loopback guard (modules/connectors/internal/egress/tunnel.go). |
Direct upstream dial (no HTTPS_PROXY chaining). No custom CA bundle propagation. Default catalogue points to a public host (modules/connectors/catalogue.go). |
1 & 5 |
| Cryptography & Keys | Label-bound age X25519 sealing + backup recipients (internal/platform/seal/seal.go). |
No key rotation (archie rekey), no KMS or HSM envelope provider, and no FIPS 140-3 build profile. |
2 |
| Identity & SSO | OIDC PKCE public client (modules/governance/oidc.go), WebAuthn passkeys, Argon2id, Cedar policies. |
No confidential OIDC client, no group-to-role claim mapping, no SSO-only mode, no SCIM 2.0 offboarding, no session TTL caps, and orgID is hardcoded to "default". |
3 |
| Approvals & SoD | Action-digest bound approvals, passkey step-up for irreversible actions, escalations (modules/approvals/approvals.go). |
No Segregation of Duties (initiator != approver), no N-of-M quorum, and ChangeRequests (modules/approvals/escalation.go) is not wired in internal/app/archie/run.go. |
3 |
| Audit & Data Gov | Credential redaction & SHA-256 capping (internal/platform/auditjson/auditjson.go); external deletion ledger (internal/platform/deletions/deletions.go). |
No unified cross-module audit export or SIEM sink, no tamper-evident hash chain or WORM archival, no retention/legal hold, and deletion ledger is local POSIX only. | 4 |
| Extension Isolation | Verified SHA-256 + CLONE_NEWUSER | CLONE_NEWNET (modules/connectors/internal/host/confine_linux.go). |
Blocked under Kubernetes restricted PSS, RuntimeDefault seccomp, and Ubuntu AppArmor. No remote or sidecar extension driver exists. |
5 |
| Stage Promotion | Versioned workflows & Cedar policy sets in Postgres. | No export/diff/apply promotion bundle across dev, staging, and prod that preserves stage credentials and autonomy history. |
6 |
| Observability & HA | JSON slog, /healthz + /readyz (internal/platform/health/health.go), OTel deps in go.mod. |
OTel traces/metrics and trace-ID log correlation are not wired in cmd/archie. No /metrics. shutdownGrace (10s) is short, and in-memory hub.Hub limits scale to 1 replica. |
7 |
Proposed Changes (Phased Tracks)
Enterprise v1 (Regulated Single-Replica Containerised): Tracks 1 to 4.
Enterprise v2 (Strict Kubernetes, Multi-Stage GitOps, Active-Active HA): Tracks 5 to 7.
Track 1: Packaging, Bootstrap, and Least-Privilege Container Runtime
[NEW] Dockerfile.archie
- Build
ui/distwith Node 24 (task ui) and staticcmd/archiewith Go 1.27 (CGO_ENABLED=0 -trimpath). - Ship on
gcr.io/distroless/static-debian12:nonroot(UID65532) with OCI labels (version,revision,source). - Support a read-only root filesystem and enterprise CA injection via
SSL_CERT_FILE.
[MODIFY] main.go
- Add
archie migrate [-config ...]to take the migration lock, run Goose migrations and runtime DML grants viaowner_url, and exit0for a KubernetesJobor Helm hook. - Add
archie bootstrap [-config ...] [-spec path]for headless first-boot setup (org, workspace, public URL, OIDC provider, and initial owner or break-glass identity).
[MODIFY] config.go
- Support env and
*_FILEloading for bootstrap secrets (ARCHIE_DATABASE_URL_FILE,ARCHIE_DATABASE_OWNER_URL_FILE,ARCHIE_AGE_IDENTITY_FILE,ARCHIE_ADMIN_TOKEN_SHA256_FILE) soconfig.tomlstays read-only. - Allow serving without
database.owner_url. On startup, check that the database schema version matches embedded migrations viapg.VerifySchemaand fail closed on mismatch. - Remove runtime writes to
config.toml(WriteAdminHash). Store rotated or revoked bootstrap token state in Postgres and disable the bootstrap token once owner setup commits. - Add
[catalogue]bootstrap overrides (location,public_key,auto_update = false) for air-gapped stages, plus configurableshutdown_grace(default30s).
[MODIFY] gate.go and health.go
- Expose
/healthz(liveness),/startupz(DB reachable, schema valid, and deletion ledger reconciled), and/readyz(readiness, with setup-mode handling behind an Ingress).
[MODIFY] pg.go
- Add
VerifySchema(ctx, db)for DML-only serving pods. - Expose pool bounds (
MaxOpenConns,MaxIdleConns,ConnMaxLifetime), requiresslmode=verify-fullin enterprise templates, and detect PgBouncer transaction pooling withClaimServe.
Track 2: Cryptography, Key Management, and FIPS 140-3 Readiness
[MODIFY] seal.go
Refactor to a versioned Sealer interface keeping compatibility with existing age (v1) records:
type Sealer interface {
KeyID() string
Seal(ctx context.Context, label string, plaintext []byte) ([]byte, error)
Open(ctx context.Context, label string, ciphertext []byte) ([]byte, error)
}
v2envelope format:{version, key_id, alg, wrapped_dek, nonce, ciphertext}using AES-256-GCM withlabelbound as AAD (ErrWrongLabelpreserved).- Backends: Keep
age(default, withage_backup_recipients) and add a KMS or Vault Transit wrapper (per-record 256-bit DEK wrapped by AWS KMS, GCP KMS, Azure Key Vault, or HashiCorp Vault Transit).
[NEW] internal/app/archie/rekey.go (archie rekey)
- Add transactional batch key rotation across
connectorscredentials andeventswebhook secrets under an advisory lock. - Check that every re-sealed record opens under the new key before committing, and write an audit event.
[MODIFY] Taskfile.yml and Release CI
- Add a FIPS 140-3 build target (
GOFIPS140=v1.0.0/GODEBUG=fips140=only) that refuses non-FIPS sealing (age) at startup unless KMS or AES-256-GCM is configured.
Track 3: Enterprise Identity, Access, and Segregation of Duties
[MODIFY] oidc.go and modules/governance/accounts_api.go
- Add confidential OIDC client support (
client_secretvia sealed store andprivate_key_jwtper RFC 7523). - Add group and role claim mapping (
groupsorrolesmapped to Archie org or workspace roles, synced on each sign-in). - Add SSO-only mode (
local_password_login = disabled) with one audited break-glass owner path that emits a high-priority security alert when used. - Add session idle timeout, absolute max lifetime, concurrent session cap, and OIDC back-channel logout (
POST /oauth2/backchannel-logout).
[NEW] modules/governance/scim.go
- Expose SCIM 2.0
/scim/v2/Usersand/scim/v2/Groupsguarded by scoped, hashed, rotatable bearer tokens. - Setting
active: falseatomically suspends the identity and revokes all browser sessions, personal API tokens, and linked channel identities.
[MODIFY] approvals.go, escalation.go, and run.go
- Segregation of Duties (SoD): Persist
InitiatorIDon approval requests. When SoD is enabled on the action type or policy, refuseanswerer.ID == req.InitiatorID(ErrSelfApprovalForbidden). - Multi-approver quorum (N-of-M): Add migration
00018_approvals_quorum.sql(required_approvalsandapprovals.votes(request_id, voter_id)). Require N distinct approvers (each passkey-confirmed if irreversible) before resuming a run. - ITSM Change Requests: Wire
allow.UseChangeRequests(...)ininternal/app/archie/run.goto a change-request extension (ServiceNow or Jira Service Management) driven byjudgement.KindChangeRequestrules. Open the CR, wait for approval and a maintenance window, and attach run evidence on close.
[MODIFY] run.go and modules/governance/
- Replace hardcoded
const orgID = "default"with principal-scopedOrgIDrouting where multi-BU tenancy runs inside a single regulated instance.
Track 4: Tamper-Evident Audit, Compliance, and Data Governance
[NEW] modules/audit/ (Unified Audit and SIEM Module)
- Append-only
audit.eventstable: Grantarchie_apponlySELECT, INSERT(noUPDATE, noDELETE) ininternal/platform/pg/pg.go. - Cryptographic hash chain: Store per-org
seq,prev_hash, andentry_hash = SHA-256(prev_hash || canonical_json), plus periodic Ed25519 or KMS signed checkpoints written to WORM storage. - Unified query and signed export API: Serve
GET /api/audit/eventsandPOST /api/audit/exports(JSONL and CSV with formula neutralisation, bounded date range, rate-limited, gated by Cedarread_audit) across auth, Cedar decisions, judgement verdicts, approvals, runs, and config changes. - Durable SIEM sinks: Run a cursor-tracked outbox worker streaming to OTLP Logs, RFC 5424 Syslog over TLS, Splunk HEC or Sentinel Webhooks, or S3/GCS Object Lock WORM storage. Report delivery lag on
/readyz.
[MODIFY] deletions.go
- Extract a
deletions.Storeinterface with two implementations: localdeletions.jsonl(existing) and WORM object storage (S3 Object Lock or GCS Bucket Lock). Cluster DR restores then preserve right-to-erasure without relying on local PVC survival.
[NEW] Retention and Legal Hold (modules/governance/, modules/memory/, and modules/runs/)
- Add per-category retention windows (audit archive, run payloads, chat transcripts, memory notes) with an automated purge worker that skips records under an active Legal Hold.
Track 5: Hardened Container Isolation and Supply Chain
[MODIFY] tunnel.go and modules/connectors/internal/host/
- Corporate proxy chaining: Allow
egress.Tunnelto forward approved hosts throughHTTPS_PROXY(respectingNO_PROXY) after enforcing Archie's per-extension allow-list and SSRF or loopback checks. - Enterprise CA propagation: Pass
SSL_CERT_FILEandSSL_CERT_DIRto botharchieand confined extensions so internal PKI works with full TLS verification.
[NEW] modules/connectors/internal/host/remote.go
- Abstract extension execution behind a
Runtimeinterface:LocalNamespaceRuntime(existingconfine_linux.go, with a documentedLocalhostseccomp profile).RemoteGRPCRuntime, connecting over mTLS to sidecar or per-extension Pods under KubernetesrestrictedPSS (readOnlyRootFilesystem,allowPrivilegeEscalation: false,capabilities.drop: [ALL]) with KubernetesNetworkPolicyenforcing egress allow-lists. Startup fails closed if neither runtime is available.
[NEW] Supply Chain and Air-Gapped Catalogue (modules/connectors/internal/catalogue/)
- Support OCI registry authentication (Docker config or workload identity) for private enterprise catalogues.
- Emit SPDX or CycloneDX SBOMs, SLSA provenance, and cosign signatures in CI for
archieimages and extensions. - Add
archie catalogue mirrorto bundle a signed catalogue and verified binaries for air-gapped networks.
Track 6: Multi-Stage Promotion and Enterprise Deployment Kit
[NEW] internal/app/archie/bundle.go (archie bundle)
Declarative promotion separating portable definitions from stage-local bindings and earned trust:
- Promoted in
bundle.yaml: workflows, Cedar access policies, judgement hard rules and change-request rules, action-type definitions, event schemas and mappings, and pinned extension digests with egress policy templates. - Stage-local in
bindings.<env>.yaml(never overwritten by promotion): credentials (secret://), sealing keys, OIDC client, public URL (preserving WebAuthn RP origin perdocs/security/authorization.md), target hosts, schedules, notification channels, and per-stage autonomy ceilings or approval counts. - Commands:
archie bundle export,archie bundle diff, andarchie bundle apply(transactional, validates viaRecheckConnector, records bundle digest in audit trail, and optionally requires a Prod approval or CR).
[NEW] deployments/helm/archie/
- Production Helm chart and Kustomize
values-{dev,staging,prod}.yamloverlays:StatefulSet(v1 active-passive) andDeployment(v2 HA),Jobpre-upgrade hook (archie migrate), split Ingress/Services (perimeter/webhooks/*vs internal Dashboard/API), default-denyNetworkPolicy,PodDisruptionBudget,ExternalSecretexamples,ServiceMonitor, andLocalhostseccomp guide.
Track 7: Observability, Resilience, and Active-Active HA
[MODIFY] run.go and api.go
- Wire OpenTelemetry (already in
go.mod):otelhttpHTTP tracing, OTLP exporter (OTEL_EXPORTER_OTLP_ENDPOINT), spans around runs, steps, LLM calls, judgements, and extension RPCs, plus aslog.Handlerinjectingtrace_idandspan_idinto every JSON log line. - Serve Prometheus
/metricson a dedicated internal metrics port (never public ingress) for run durations and states, approval SLA age, judgement verdicts, extension health, DB pool stats, and SIEM or deletion-ledger lag. - Graceful drain: On
SIGTERM, flip/readyzto503at once, stop claiming new runs, and drain active HTTP requests and step checkpoints up toshutdown_grace.
[MODIFY] hub.go and internal/platform/pg/lease.go (Enterprise v2 HA)
- Back
hub.Hubwith PostgreSQLLISTEN/NOTIFY(archie_live) so live dashboard SSE works across multiple replicas with zero extra brokers. - Add PostgreSQL lease-based leader election for singleton loops (
eventspolling sources,connectors.WatchUpdates,deliveriesbot listeners, and SIEM outbox), complementingruns.Engine's existing per-run leases.
[NEW] docs/enterprise/ Runbooks and Compliance Evidence Pack
deployment-architecture.md(multi-stage zones, PgBouncer session-pool requirement, Kubernetes PSS and seccomp).dr-and-backup.md(RPO/RTO targets, independent backup of Postgres plus recovery key/KMS and deletion ledger, restore drill).compliance-control-mapping.md(mapping Archie controls and automated tests to SOC 2 CC6 to CC8, ISO 27001, and SOX ITGC).
Verification Plan
Automated Tests (task check)
All changes must pass task check (go test -short, golangci-lint, gosec, generated OpenAPI/SQL checks). Add seam-focused boundary tests per track:
- Track 1:
go test -short ./internal/app/archie/... ./internal/platform/pg/...checking runtime-only boot fails closed on schema lag,*_FILEsecret loading, read-only config dir, and/healthz,/startupz, and/readyzstates. - Track 2:
go test -short ./internal/platform/seal/... ./internal/app/archie/...checkingv1tov2decryption compatibility,ErrWrongLabeltamper check, transactionalrekeyrollback, and FIPS-mode rejection of non-FIPS sealers. - Track 3:
go test -short ./modules/governance/... ./modules/approvals/...checking confidential OIDC plus group claim mapping, SSO-only password refusal, SCIM suspension revoking sessions and tokens, SoD self-approval refusal, and N-of-M quorum. - Track 4:
go test -short ./modules/audit/... ./internal/platform/deletions/...checking hash-chain tamper detection, runtime roleUPDATEandDELETErefusal onaudit.events, legal hold blocking purge, and SIEM outbox durability. - Track 5:
go test -short ./modules/connectors/internal/egress/... ./modules/connectors/internal/host/...checking allow-list and SSRF check run before corporate proxy chaining, and remote gRPC runtime enforces mTLS. - Track 6:
go test -short ./internal/app/archie/... ./modules/runs/...checking transactional bundle apply refuses breaking connector drift while preserving stage credentials and earned-autonomy history. - Track 7:
go test -short ./internal/platform/hub/... ./internal/app/archie/...checking trace-ID injection in JSON logs, graceful drain stops claiming runs onSIGTERM, andLISTEN/NOTIFYcross-hub fan-out.
Manual and Container Verification
- Container and Kubernetes hardening: Build
Dockerfile.archieand scan it with Trivy or Grype (0 critical or high CVEs). Check non-root UID65532and a read-only root filesystem (--read-only). Deploy the Helm chart tokindork3sand check thearchie migrateJob vs DML-only serving Pod. - Air-gapped and proxy drill: Run on a zero-internet container network routed exclusively via forward proxy and private CA. Check OIDC login, private OCI catalogue install, and extension egress allow-list.
- Promotion and SoD drill: Export bundle from
staging, rundiffandapplytoprod, and confirm credentials and autonomy ceilings stay intact. Check self-approval rejection, 2-person passkey quorum, ITSM CR lifecycle, and hash-chained SIEM output. - DR restore and deletion ledger drill: Delete a memory note, restore Postgres from a pre-deletion snapshot, boot
archie, and confirm the note remains deleted and the audit hash chain verifies intact.