Objective
Build the identity and persistence layer required before ZASI may expose autonomous or multi-user control-plane behavior.
Source-grounded findings
backend/server.py uses an optional static X-API-Key; when the environment key is empty, API authentication is disabled.
- WebSocket upgrade handling occurs before normal API auth middleware.
- Rate-limit windows and WebSocket client state are process-local.
src/api_server.py contains a hard-coded default bearer token and in-memory audit log.
- Current SQLite persistence stores selected state variables, not principals, sessions, approvals, events, evidence, or durable runs.
Scope
- Add principal, tenant/workspace, device, session, role/capability, and credential contracts.
- Centralize authentication middleware for REST, SSE, WebSocket, MCP, files, and connectors.
- Enforce tenant/device scope in repository methods, never from untrusted request fields.
- Add migration-managed persistence: SQLite local profile; PostgreSQL production/multi-process profile.
- Add durable immutable audit/event records and transactional outbox.
- Persist/recover sessions, approvals, cursors, idempotency records, and rate-limit state where required.
- Add secret redaction and credential rotation/revocation behavior.
Acceptance criteria
Depends on
#9
Priority
P1 / foundation.
Objective
Build the identity and persistence layer required before ZASI may expose autonomous or multi-user control-plane behavior.
Source-grounded findings
backend/server.pyuses an optional staticX-API-Key; when the environment key is empty, API authentication is disabled.src/api_server.pycontains a hard-coded default bearer token and in-memory audit log.Scope
Acceptance criteria
Depends on
#9
Priority
P1 / foundation.