docs(enterprise): lock in v1 and v2 enterprise readiness decisions
This commit is contained in:
1 file changed
+103
-185
+103
-185
@@ -4,42 +4,24 @@
|
||||
|
||||
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`.
|
||||
This plan sets out the locked 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)
|
||||
## Locked Decisions
|
||||
|
||||
> [!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.
|
||||
These architectural choices are locked in for Enterprise v1 and Enterprise v2:
|
||||
|
||||
> [!WARNING]
|
||||
> **2. Nested user namespaces (`CLONE_NEWUSER`) conflict with hardened Kubernetes clusters**
|
||||
> `modules/connectors/internal/host/confine_linux.go` runs every extension and stdio MCP server in `CLONE_NEWUSER | CLONE_NEWNET` with no fallback. Kubernetes `restricted` Pod Security Standards, `RuntimeDefault` seccomp, OpenShift security constraints, and Ubuntu or RHEL unprivileged-userns AppArmor profiles block this.
|
||||
> **Proposed approach:** Support a documented `Localhost` seccomp 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 separate `restricted` Pods governed by Kubernetes `NetworkPolicy`.
|
||||
|
||||
> [!WARNING]
|
||||
> **3. FIPS 140-3 and cryptographic sealing (`age` vs KMS envelope encryption)**
|
||||
> `internal/platform/seal/seal.go` uses `age` (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 pluggable `seal.Sealer` that keeps `age` as the default while enabling KMS or Vault Transit and FIPS builds.
|
||||
|
||||
> [!CAUTION]
|
||||
> **4. Control-plane mutability vs GitOps change control**
|
||||
> `PRODUCT.md` makes 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`, and `apply` with an approval gate) rather than replacing the control plane with static YAML.
|
||||
|
||||
---
|
||||
|
||||
## Open Questions
|
||||
|
||||
Confirm your choice on these five decisions before starting work:
|
||||
|
||||
1. **Target orchestrator:** Should the deployment kit target Kubernetes (Helm and Kustomize) first with hardened Compose secondary, or both equally?
|
||||
2. **FIPS 140-3 timing:** Is `GOFIPS140` with AES-256-GCM and KMS envelope encryption needed in v1? Or should `age`, `archie rekey`, and a Vault/OpenBao engine ship first?
|
||||
3. **Strict Kubernetes extension runner:** Should the remote or sidecar gRPC extension runtime ship in v1? Or should it wait until a cluster blocks `Localhost` seccomp?
|
||||
4. **Identity lifecycle:** Should OIDC confidential client and group claim mapping ship first, or include SCIM 2.0 provisioning in the same milestone?
|
||||
5. **High availability timing:** Is Active-Passive (one active replica plus HA PostgreSQL) enough for v1, leaving Active-Active HA (`LISTEN/NOTIFY` hub and leased pollers) for v2?
|
||||
1. **Hard isolation per Archie stage (`dev`, `staging`, and `prod`):** Each stage runs its own Archie instance. It keeps its own Postgres database, sealing key, OIDC client, egress allow-list, and approval log. Earned autonomy in Staging never carries over to Production. One Production instance can still manage non-prod and prod servers using CMDB facts and Cedar rules.
|
||||
2. **Orchestrator priority:** Kubernetes and Helm first, with hardened Docker Compose secondary.
|
||||
3. **Extension confinement in strict Kubernetes:** Ship static remote gRPC+mTLS extension endpoints in v1 (never SSH), passing Kubernetes `restricted` Pod Security Standards and `NetworkPolicy`, alongside existing `CLONE_NEWUSER` confinement for Compose and VMs.
|
||||
4. **Cryptography and secret offloading:** Keep `age`, add `archie rekey`, and ship a Vault/OpenBao secret engine extension in v1 so target credentials stay in the enterprise secret manager. Do not bundle cloud KMS SDKs. Defer FIPS 140-3 stdlib AES-256-GCM sealing (`GOFIPS140`) to v2.
|
||||
5. **Control-plane mutability and promotion:** Keep the dashboard as the complete control plane, and add versioned promotion bundles (`archie bundle export`, `diff`, and `apply`) for peer-reviewed promotion across stages.
|
||||
6. **Identity and approvals:** Ship OIDC confidential client, group-to-role claim mapping, SSO-only mode, session timeouts, four-eyes Segregation of Duties (`initiator != approver`), and ITSM `ChangeRequests` wiring in v1. Defer SCIM 2.0 and N-of-M quorum to v2.
|
||||
7. **Audit and telemetry:** Ship an append-only `audit` table (`INSERT` and `SELECT` only for `archie_app`), structured JSON audit logs to stdout, and a unified audit export API. Customer log collectors handle SIEM shipping, WORM retention, and Legal Hold. Also ship OTel tracing with trace-ID logs, internal `/metrics`, and graceful `SIGTERM` drain in v1. Defer cryptographic hash-chaining to v2.
|
||||
8. **High availability:** Ship Active-Passive (one active replica plus HA PostgreSQL) in v1. Document Active-Active HA (`LISTEN/NOTIFY` hub, Postgres lease leader election for pollers, and shared WORM deletion ledger) in v2 so requirements are preserved.
|
||||
|
||||
---
|
||||
|
||||
@@ -58,32 +40,30 @@ flowchart LR
|
||||
subgraph DEV["Dev Stage (Isolated)"]
|
||||
D_ARC["archie (dev)"]
|
||||
D_DB[("PostgreSQL (dev)")]
|
||||
D_KMS["KMS / Vault (dev)"]
|
||||
D_SEC["Vault / OpenBao (dev)"]
|
||||
D_ARC --> D_DB
|
||||
D_ARC --> D_KMS
|
||||
D_ARC --> D_SEC
|
||||
end
|
||||
|
||||
subgraph STG["Staging Stage (Isolated)"]
|
||||
S_ARC["archie (staging)"]
|
||||
S_DB[("PostgreSQL (staging)")]
|
||||
S_KMS["KMS / Vault (staging)"]
|
||||
S_SEC["Vault / OpenBao (staging)"]
|
||||
S_ARC --> S_DB
|
||||
S_ARC --> S_KMS
|
||||
S_ARC --> S_SEC
|
||||
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_SEC["Vault / OpenBao (prod)"]
|
||||
P_LOG["Customer Log Collector\n(Stdout JSON -> SIEM / WORM)"]
|
||||
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_SEC
|
||||
P_ARC --> P_LOG
|
||||
P_ARC --> P_ITSM
|
||||
end
|
||||
|
||||
@@ -105,191 +85,129 @@ flowchart TD
|
||||
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)"]
|
||||
POD -->|Unix socket or remote mTLS gRPC| EXT["Isolated Extensions\n(Allow-list Egress / NetworkPolicy)"]
|
||||
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")]
|
||||
POD -->|RWO PVC| STATE[("state_dir / Deletion Ledger")]
|
||||
end
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Current-State Baseline vs Regulated-Enterprise Gap Matrix
|
||||
## Enterprise v1 (Build Now)
|
||||
|
||||
| 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 |
|
||||
Enterprise v1 delivers a lean, auditable, Active-Passive containerised deployment across six tracks.
|
||||
|
||||
---
|
||||
|
||||
## 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
|
||||
### Track 1: Container Packaging, Bootstrap, and Least-Privilege Runtime
|
||||
|
||||
#### [NEW] `Dockerfile.archie`
|
||||
- Build `ui/dist` with Node 24 (`task ui`) and static `cmd/archie` with Go 1.27 (`CGO_ENABLED=0 -trimpath`).
|
||||
- Ship on `gcr.io/distroless/static-debian12:nonroot` (UID `65532`) with OCI labels (`version`, `revision`, `source`).
|
||||
- Support a read-only root filesystem and enterprise CA injection via `SSL_CERT_FILE`.
|
||||
- Build `ui/dist` with Node 24 (`pnpm run build`) and static `cmd/archie` with Go 1.27 (`CGO_ENABLED=0 -trimpath`).
|
||||
- Ship on `gcr.io/distroless/static-debian12:nonroot` (UID `65532`) with OCI labels and read-only root filesystem compatibility.
|
||||
- Support enterprise CA bundles via `SSL_CERT_FILE`.
|
||||
|
||||
#### [MODIFY] [main.go](../../cmd/archie/main.go)
|
||||
- Add `archie migrate [-config ...]` to take the migration lock, run Goose migrations and runtime DML grants via `owner_url`, and exit `0` for a Kubernetes `Job` or 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] `cmd/archie/main.go` and `internal/app/archie/run.go`
|
||||
- Add `archie migrate [-config ...]` to acquire the migration lock, run Goose migrations and runtime DML grants via `owner_url`, and exit `0` for a Kubernetes `Job` or Helm pre-upgrade hook.
|
||||
- Add `archie bootstrap [-config ...] [-spec path]` for idempotent headless first-boot setup (org, workspace, public URL, OIDC provider, and initial owner or break-glass identity).
|
||||
|
||||
#### [MODIFY] [config.go](../../internal/app/archie/config.go)
|
||||
- Support env and `*_FILE` loading for bootstrap secrets (`ARCHIE_DATABASE_URL_FILE`, `ARCHIE_DATABASE_OWNER_URL_FILE`, `ARCHIE_AGE_IDENTITY_FILE`, `ARCHIE_ADMIN_TOKEN_SHA256_FILE`) so `config.toml` stays read-only.
|
||||
- Allow serving without `database.owner_url`. On startup, check that the database schema version matches embedded migrations via `pg.VerifySchema` and 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 configurable `shutdown_grace` (default `30s`).
|
||||
#### [MODIFY] `internal/app/archie/config.go` and `internal/platform/pg/pg.go`
|
||||
- Support env and `*_FILE` overrides for bootstrap secrets (`ARCHIE_DATABASE_URL`, `ARCHIE_DATABASE_OWNER_URL`, `ARCHIE_AGE_IDENTITY`, `ARCHIE_ADMIN_TOKEN_SHA256`, and `*_FILE` variants) so `config.toml` stays non-secret and read-only.
|
||||
- Allow serving without `database.owner_url`. In DML-only mode, `pg.VerifySchema` checks that all embedded migrations are applied and fails closed on lag.
|
||||
- Grant `SELECT` on `public.goose_db_version` to the runtime role in `pg.grantRuntime`.
|
||||
- Remove runtime writes to `config.toml` (`WriteAdminHash` in running servers) and add configurable `shutdown_grace` (default `30s`) plus `[catalogue]` overrides for air-gapped stages.
|
||||
|
||||
#### [MODIFY] [gate.go](../../internal/app/archie/gate.go) and [health.go](../../internal/platform/health/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] `internal/platform/health/health.go` and `internal/app/archie/gate.go`
|
||||
- Separate `/healthz` (liveness), `/startupz` (DB reachable, schema verified, and deletion ledger ready), and `/readyz` (readiness, returning `503` on `SIGTERM` drain).
|
||||
|
||||
#### [MODIFY] [pg.go](../../internal/platform/pg/pg.go)
|
||||
- Add `VerifySchema(ctx, db)` for DML-only serving pods.
|
||||
- Expose pool bounds (`MaxOpenConns`, `MaxIdleConns`, `ConnMaxLifetime`), require `sslmode=verify-full` in enterprise templates, and detect PgBouncer transaction pooling with `ClaimServe`.
|
||||
#### [MODIFY] `modules/connectors/internal/egress/tunnel.go` and `modules/connectors/internal/host/host.go`
|
||||
- Chain allowed egress hosts through `HTTPS_PROXY` (respecting `NO_PROXY`) after enforcing Archie's allow-list and loopback/SSRF checks.
|
||||
- Propagate `SSL_CERT_FILE` and `SSL_CERT_DIR` into confined extensions so internal PKI works with full TLS checks.
|
||||
|
||||
---
|
||||
|
||||
### Track 2: Cryptography, Key Management, and FIPS 140-3 Readiness
|
||||
|
||||
#### [MODIFY] [seal.go](../../internal/platform/seal/seal.go)
|
||||
Refactor to a versioned `Sealer` interface keeping compatibility with existing `age` (`v1`) records:
|
||||
```go
|
||||
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)
|
||||
}
|
||||
```
|
||||
- **`v2` envelope format:** `{version, key_id, alg, wrapped_dek, nonce, ciphertext}` using AES-256-GCM with `label` bound as AAD (`ErrWrongLabel` preserved).
|
||||
- **Backends:** Keep `age` (default, with `age_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 `connectors` credentials and `events` webhook 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](../../modules/governance/oidc.go) and `modules/governance/accounts_api.go`
|
||||
- Add confidential OIDC client support (`client_secret` via sealed store and `private_key_jwt` per RFC 7523).
|
||||
- Add group and role claim mapping (`groups` or `roles` mapped 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/Users` and `/scim/v2/Groups` guarded by scoped, hashed, rotatable bearer tokens.
|
||||
- Setting `active: false` atomically suspends the identity and revokes all browser sessions, personal API tokens, and linked channel identities.
|
||||
|
||||
#### [MODIFY] [approvals.go](../../modules/approvals/approvals.go), [escalation.go](../../modules/approvals/escalation.go), and [run.go](../../internal/app/archie/run.go)
|
||||
- **Segregation of Duties (SoD):** Persist `InitiatorID` on approval requests. When SoD is enabled on the action type or policy, refuse `answerer.ID == req.InitiatorID` (`ErrSelfApprovalForbidden`).
|
||||
- **Multi-approver quorum (N-of-M):** Add migration `00018_approvals_quorum.sql` (`required_approvals` and `approvals.votes(request_id, voter_id)`). Require N distinct approvers (each passkey-confirmed if irreversible) before resuming a run.
|
||||
- **ITSM Change Requests:** Wire `allow.UseChangeRequests(...)` in `internal/app/archie/run.go` to a change-request extension (ServiceNow or Jira Service Management) driven by `judgement.KindChangeRequest` rules. Open the CR, wait for approval and a maintenance window, and attach run evidence on close.
|
||||
|
||||
#### [MODIFY] [run.go](../../internal/app/archie/run.go) and `modules/governance/`
|
||||
- Replace hardcoded `const orgID = "default"` with principal-scoped `OrgID` routing 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.events` table:** Grant `archie_app` only `SELECT, INSERT` (no `UPDATE`, no `DELETE`) in `internal/platform/pg/pg.go`.
|
||||
- **Cryptographic hash chain:** Store per-org `seq`, `prev_hash`, and `entry_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/events` and `POST /api/audit/exports` (JSONL and CSV with formula neutralisation, bounded date range, rate-limited, gated by Cedar `read_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](../../internal/platform/deletions/deletions.go)
|
||||
- Extract a `deletions.Store` interface with two implementations: local `deletions.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](../../modules/connectors/internal/egress/tunnel.go) and `modules/connectors/internal/host/`
|
||||
- **Corporate proxy chaining:** Allow `egress.Tunnel` to forward approved hosts through `HTTPS_PROXY` (respecting `NO_PROXY`) after enforcing Archie's per-extension allow-list and SSRF or loopback checks.
|
||||
- **Enterprise CA propagation:** Pass `SSL_CERT_FILE` and `SSL_CERT_DIR` to both `archie` and confined extensions so internal PKI works with full TLS verification.
|
||||
### Track 2: Kubernetes Extension Isolation and Supply Chain
|
||||
|
||||
#### [NEW] `modules/connectors/internal/host/remote.go`
|
||||
- Abstract extension execution behind a `Runtime` interface:
|
||||
1. `LocalNamespaceRuntime` (existing `confine_linux.go`, with a documented `Localhost` seccomp profile).
|
||||
2. `RemoteGRPCRuntime`, connecting over mTLS to sidecar or per-extension Pods under Kubernetes `restricted` PSS (`readOnlyRootFilesystem`, `allowPrivilegeEscalation: false`, `capabilities.drop: [ALL]`) with Kubernetes `NetworkPolicy` enforcing egress allow-lists. Startup fails closed if neither runtime is available.
|
||||
- Add a `Runtime` abstraction supporting `LocalNamespaceRuntime` (existing `CLONE_NEWUSER | CLONE_NEWNET` for Compose/VMs) and `RemoteGRPCRuntime` (static gRPC+mTLS endpoints for sidecar or dedicated extension Pods running under Kubernetes `restricted` PSS and `NetworkPolicy`). Fail closed if neither 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 `archie` images and extensions.
|
||||
- Add `archie catalogue mirror` to bundle a signed catalogue and verified binaries for air-gapped networks.
|
||||
#### [NEW] Air-Gapped Catalogue and Supply Chain (`modules/connectors/internal/catalogue/`)
|
||||
- Support OCI registry authentication for internal extension mirrors.
|
||||
- Emit SPDX/CycloneDX SBOMs, SLSA provenance, and cosign signatures in CI for `archie` images and extensions, plus `archie catalogue mirror` for air-gapped transfer.
|
||||
|
||||
---
|
||||
|
||||
### Track 6: Multi-Stage Promotion and Enterprise Deployment Kit
|
||||
### Track 3: Key Rotation and Enterprise Secret Offloading
|
||||
|
||||
#### [NEW] `internal/app/archie/rekey.go` (`archie rekey`)
|
||||
- Rotate `age` identities across `connectors` credentials and `events` webhook secrets in transactional batches under an advisory lock, checking decryption before commit and logging an audit event.
|
||||
|
||||
#### [NEW] Vault and OpenBao Secret Engine Extension
|
||||
- Offload target infrastructure credentials to the customer's secret manager using Archie's existing `secretengine/v1` contract.
|
||||
|
||||
---
|
||||
|
||||
### Track 4: Enterprise Identity, Approvals, and Segregation of Duties
|
||||
|
||||
#### [MODIFY] `modules/governance/oidc.go` and `modules/governance/accounts_api.go`
|
||||
- Add confidential OIDC client auth (`client_secret` and `private_key_jwt`), group-to-role claim mapping synced on sign-in, SSO-only mode with audited break-glass alerting, idle/max session lifetimes, and OIDC back-channel logout (`POST /oauth2/backchannel-logout`).
|
||||
|
||||
#### [MODIFY] `modules/approvals/approvals.go` and `internal/app/archie/run.go`
|
||||
- **Segregation of Duties (SoD):** Persist `InitiatorID` on approval requests and reject self-approval (`answerer.ID == req.InitiatorID`) when SoD applies.
|
||||
- **ITSM Change Requests:** Wire `allow.UseChangeRequests(...)` in `internal/app/archie/run.go` to a ServiceNow or Jira Service Management extension driven by `judgement.KindChangeRequest` rules.
|
||||
|
||||
---
|
||||
|
||||
### Track 5: Audit Stream, OpenTelemetry, and Prometheus Metrics
|
||||
|
||||
#### [NEW] `modules/audit/` (Append-Only Audit Table and Unified Export)
|
||||
- Create an append-only `audit.events` table where `archie_app` holds only `SELECT` and `INSERT` privileges.
|
||||
- Emit every audit record as structured JSON to stdout so the customer's log collector (Fluent Bit, Vector, OTel Collector, or Splunk Forwarder) routes it to SIEM and WORM retention.
|
||||
- Serve a unified Cedar-gated export API (`GET /api/audit/events` and `POST /api/audit/exports`).
|
||||
|
||||
#### [MODIFY] `internal/app/archie/run.go` and `internal/app/archie/api.go`
|
||||
- Wire `otelhttp` and OTLP trace export (`OTEL_EXPORTER_OTLP_ENDPOINT`), spans around runs, steps, LLM calls, judgements, and extensions, plus a `slog.Handler` injecting `trace_id` and `span_id`.
|
||||
- Serve Prometheus `/metrics` on an internal-only port and drain active HTTP requests and run checkpoints on `SIGTERM` up to `shutdown_grace`.
|
||||
|
||||
---
|
||||
|
||||
### Track 6: Multi-Stage Promotion and Helm 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 per `docs/security/authorization.md`), target hosts, schedules, notification channels, and per-stage autonomy ceilings or approval counts.
|
||||
- **Commands:** `archie bundle export`, `archie bundle diff`, and `archie bundle apply` (transactional, validates via `RecheckConnector`, records bundle digest in audit trail, and optionally requires a Prod approval or CR).
|
||||
- Separate portable definitions (`bundle.yaml`: workflows, Cedar policies, judgement rules, action types, event schemas, and extension digest pins) from stage-local bindings (`bindings.<env>.yaml`: credentials, OIDC client, public URL, target hosts, schedules, channels, and per-stage autonomy ceilings).
|
||||
- Provide `archie bundle export`, `diff`, and `apply` (transactional, runs `RecheckConnector`, preserves earned autonomy counts, and supports a Prod approval gate).
|
||||
|
||||
#### [NEW] `deployments/helm/archie/`
|
||||
- Production Helm chart and Kustomize `values-{dev,staging,prod}.yaml` overlays:
|
||||
- `StatefulSet` (v1 active-passive) and `Deployment` (v2 HA), `Job` pre-upgrade hook (`archie migrate`), split Ingress/Services (perimeter `/webhooks/*` vs internal Dashboard/API), default-deny `NetworkPolicy`, `PodDisruptionBudget`, `ExternalSecret` examples, `ServiceMonitor`, and `Localhost` seccomp guide.
|
||||
#### [NEW] `deployments/helm/archie/` and Hardened Compose
|
||||
- Ship a Helm chart with `values-{dev,staging,prod}.yaml` overlays: `StatefulSet` (Active-Passive, 1 replica + RWO PVC), `Job` pre-upgrade hook (`archie migrate`), split Ingress (perimeter `/webhooks/*` vs internal Dashboard/API), default-deny `NetworkPolicy`, `ExternalSecret` examples, `ServiceMonitor`, and hardened Compose overlay.
|
||||
- Document Postgres pool settings (requiring PgBouncer session pooling for `ClaimServe`) and independent backup/restore of Postgres, recovery keys, and the deletion ledger.
|
||||
|
||||
---
|
||||
|
||||
### Track 7: Observability, Resilience, and Active-Active HA
|
||||
## Enterprise v2 (Documented for Demand)
|
||||
|
||||
#### [MODIFY] [run.go](../../internal/app/archie/run.go) and [api.go](../../internal/app/archie/api.go)
|
||||
- Wire OpenTelemetry (already in `go.mod`): `otelhttp` HTTP tracing, OTLP exporter (`OTEL_EXPORTER_OTLP_ENDPOINT`), spans around runs, steps, LLM calls, judgements, and extension RPCs, plus a `slog.Handler` injecting `trace_id` and `span_id` into every JSON log line.
|
||||
- Serve Prometheus `/metrics` on 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 `/readyz` to `503` at once, stop claiming new runs, and drain active HTTP requests and step checkpoints up to `shutdown_grace`.
|
||||
These items are deferred from v1 so engineering effort stays focused, while interfaces avoid locking them out:
|
||||
|
||||
#### [MODIFY] [hub.go](../../internal/platform/hub/hub.go) and `internal/platform/pg/lease.go` (Enterprise v2 HA)
|
||||
- Back `hub.Hub` with PostgreSQL `LISTEN/NOTIFY` (`archie_live`) so live dashboard SSE works across multiple replicas with zero extra brokers.
|
||||
- Add PostgreSQL lease-based leader election for singleton loops (`events` polling sources, `connectors.WatchUpdates`, `deliveries` bot listeners, and SIEM outbox), complementing `runs.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).
|
||||
1. **Active-Active HA:** Back `hub.Hub` (`internal/platform/hub/hub.go`) with PostgreSQL `LISTEN/NOTIFY`, add PostgreSQL lease-based leader election for polling sources and channel listeners, and add an S3/GCS Object Lock store for `deletions.Store` (`internal/platform/deletions/deletions.go`).
|
||||
2. **FIPS 140-3 Sealing Profile:** Add a stdlib AES-256-GCM `seal.Sealer` compiled with `GOFIPS140=v1.0.0`, reading the master key from an External Secrets / CSI KMS mount.
|
||||
3. **SCIM 2.0 Lifecycle:** Add `/scim/v2/Users` and `/scim/v2/Groups` for automated IdP provisioning and instant offboarding.
|
||||
4. **N-of-M Approval Quorum:** Add `approvals.votes` requiring multiple distinct approvers for high-risk production actions.
|
||||
5. **Cryptographic Audit Hash Chain and Multi-Org Tenancy:** Add per-org `prev_hash`/`entry_hash` chaining on `audit.events` and replace single-org routing (`const orgID = "default"`) when multi-BU tenancy in one instance is needed.
|
||||
|
||||
---
|
||||
|
||||
## 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, `*_FILE` secret loading, read-only config dir, and `/healthz`, `/startupz`, and `/readyz` states.
|
||||
- **Track 2:** `go test -short ./internal/platform/seal/... ./internal/app/archie/...` checking `v1` to `v2` decryption compatibility, `ErrWrongLabel` tamper check, transactional `rekey` rollback, 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 role `UPDATE` and `DELETE` refusal on `audit.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 on `SIGTERM`, and `LISTEN/NOTIFY` cross-hub fan-out.
|
||||
All changes must pass `task check` (`go test -short`, `golangci-lint`, `gosec`, generated OpenAPI/SQL checks). Add boundary tests per track:
|
||||
- **Track 1:** `go test -short ./internal/app/archie/... ./internal/platform/pg/... ./internal/platform/health/... ./modules/connectors/internal/...` tests schema checks, `*_FILE` secret loading, `/startupz` vs `/readyz`, `HTTPS_PROXY` allow-lists, and CA env forwarding.
|
||||
- **Track 2:** `go test -short ./modules/connectors/internal/host/...` tests `RemoteGRPCRuntime` mTLS checks and fail-closed startup.
|
||||
- **Track 3:** `go test -short ./internal/app/archie/...` tests atomic `archie rekey` rollback on failure.
|
||||
- **Track 4:** `go test -short ./modules/governance/... ./modules/approvals/...` tests confidential OIDC, group claim mapping, SSO-only refusal, and SoD self-approval refusal.
|
||||
- **Track 5:** `go test -short ./modules/audit/... ./internal/app/archie/...` tests runtime `UPDATE`/`DELETE` refusal on `audit.events`, trace-ID log injection, and `SIGTERM` drain.
|
||||
- **Track 6:** `go test -short ./internal/app/archie/... ./modules/runs/...` tests that `archie bundle apply` keeps earned autonomy and stage credentials.
|
||||
|
||||
### Manual and Container Verification
|
||||
1. **Container and Kubernetes hardening:** Build `Dockerfile.archie` and scan it with Trivy or Grype (0 critical or high CVEs). Check non-root UID `65532` and a read-only root filesystem (`--read-only`). Deploy the Helm chart to `kind` or `k3s` and check the `archie migrate` Job vs DML-only serving Pod.
|
||||
2. **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.
|
||||
3. **Promotion and SoD drill:** Export bundle from `staging`, run `diff` and `apply` to `prod`, and confirm credentials and autonomy ceilings stay intact. Check self-approval rejection, 2-person passkey quorum, ITSM CR lifecycle, and hash-chained SIEM output.
|
||||
4. **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.
|
||||
1. **Container and Kubernetes hardening:** Build `Dockerfile.archie`, scan with Trivy or Grype (0 critical or high CVEs), and verify UID `65532` with `--read-only` root filesystem. Deploy the Helm chart to `kind` or `k3s` under `restricted` PSS, checking `archie migrate` Job vs DML-only Pod.
|
||||
2. **Proxy and air-gapped drill:** Run on a zero-internet network behind an HTTP proxy and private CA, verifying OIDC login, private OCI extension install, and egress allow-lists.
|
||||
3. **Promotion and SoD drill:** Export bundle from `staging`, run `diff` and `apply` to `prod`, and confirm credentials and autonomy ceilings stay intact. Check self-approval rejection, ITSM CR creation, and stdout audit JSON output.
|
||||
4. **DR restore drill:** Delete a memory note, restore Postgres from a pre-deletion snapshot, boot `archie`, and confirm the note remains deleted via the deletion ledger.
|
||||
Reference in new issue
Block a user