Audit storage: append-only schema с retention policies

## Что это Audit storage — append-only таблица в `~/.rox/audit/audit.db` (SQLite). Schema: `(id INTEGER PRIMARY KEY, ts INTEGER UTC ms, actor TEXT, event TEXT, scope JSON, payload JSON, hash TEXT)`. `hash` = SHA-256 of prev-row-hash + canonicalized JSON of current row → формирует hash-chain. Retention policies — per event-category: - `auth.*` — 7 лет (compliance) - `mission.*` — 1 год - `tool.*` — 90 дней - `viewer.*` — 30 дней Категории конфигурируются per workspace. Старше retention — soft-delete с tombstone row, чтобы hash-chain не разорвать. Cron job каждую ночь runs verify+prune. Компоненты: `@rox-one/audit`, `packages/audit/`. Verifier утилита checks integrity full chain или slice (для performance). ## Зачем Without structured audit storage compliance-вопросы (GDPR, SOC2, HIPAA в enterprise) нерешаемы. Hash-chain даёт tamper-evidence: модификация любой строки ломает hash верифика. Per-category retention балансирует compliance с диск usage. T218 schema + verifier. ## Источники вдохновения - [databendlabs/databend](https://github.com/databendlabs/databend) — cloud-native append-only event store query - [OneUptime/oneuptime](https://github.com/OneUptime/oneuptime) — structured logging с retention - [Openpanel-dev/openpanel](https://github.com/Openpanel-dev/openpanel) — event tracking ingestion+retention ## 🔗 Linear - [PZD-430](https://linear.app/kuhjie/issue/PZD-430) — backing ticket

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
🏢

Enterprise, B2B

Date

About 19 hours ago

Author

agi

Subscribe to post

Get notified by email when there are changes.