docs(enterprise): add enterprise readiness design and plan
This commit is contained in:
1 file changed
+295
@@ -0,0 +1,295 @@
|
||||
# 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 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?
|
||||
|
||||
---
|
||||
|
||||
## Target Architecture
|
||||
|
||||
### Multi-Stage Regulated Deployment Topology
|
||||
|
||||
```mermaid
|
||||
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
|
||||
|
||||
```mermaid
|
||||
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/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`.
|
||||
|
||||
#### [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] [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] [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] [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`.
|
||||
|
||||
---
|
||||
|
||||
### 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.
|
||||
|
||||
#### [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.
|
||||
|
||||
#### [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.
|
||||
|
||||
---
|
||||
|
||||
### 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 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).
|
||||
|
||||
#### [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.
|
||||
|
||||
---
|
||||
|
||||
### Track 7: Observability, Resilience, and Active-Active HA
|
||||
|
||||
#### [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`.
|
||||
|
||||
#### [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).
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
|
||||
### 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.
|
||||
Reference in new issue
Block a user