All my work / Storage & data systems · by Ravindra Sawant
Warden
Data governance catalog: explainable grants, row filters, column masks, lineage impact.
Verified 2026-11-28; CI re-runs the acceptance tests on every push.
The problem
Data platforms need consistent discovery, ownership, permissions and lineage across teams. This Unity-Catalog-inspired governance service focuses on explainable policy evaluation rather than metadata CRUD.
What I found
- Every allow/deny decision is a list of explicit checks (USE_CATALOG, USE_SCHEMA, SELECT) naming the grant or ownership that satisfied it.
- Two tenants reading the same table see only their own rows; card numbers are masked for everyone, emails only for non-PII readers, and projections are rebuilt so hidden columns never leak.
- Lineage impact analysis redacts the names of assets you cannot see; if the audit store fails, reads fail closed.
Architecture
identity (registered user/service) ─► principal set = user ∪ direct groups
authorize(user, SELECT, catalog.schema.table):
admin? ─► allow
[USE_CATALOG on catalog] own level only (grant to principal set, or ownership)
[USE_SCHEMA on schema ] own level only
[SELECT on table | schema | catalog] inherited downward, or table ownership
─► Decision(allow, checks[{check, ok, via}], policy revision) ─► explain()
read(user, table, columns) ─► authorize (every call; no decision cache) ─► allowlisted CSV under data_root
─► row filter: governed + no applicable policy ⇒ 0 rows; restrictions AND-ed; '$attr' = principal attribute;
trusted 'all' exception for named groups ─► masks: specific-group policies beat '*', most restrictive wins
(null > redact > hash > last4 > none; unmatched ⇒ redact) ─► rows rebuilt from projected masked values
─► audit (failure ⇒ AuditError, nothing returned)
lineage: trusted pipeline principal ─► edges (table/column) ─► impact BFS (visited set, max depth, hidden names redacted)
- Mutations (grants, memberships, policies) bump a policy revision included in every decision and audit row.
- Memberships and ownership are admin-only; delegated MANAGE holders cannot grant to themselves/their groups or re-delegate MANAGE.
- All metadata/privilege edits are SQLite transactions (invalid grants roll back).
Requirements → tests
| Req | Pri | Requirement | Proven by | Status |
|---|---|---|---|---|
| FR-01 | P0 | Catalogs/schemas/tables/columns with stable IDs, owners, tags, storage refs; FQN resolution; unique names | T02, T05 | pass |
| FR-02 | P0 | Users, groups, membership; grant/revoke USE_CATALOG/USE_SCHEMA/SELECT/MANAGE with defined inheritance | T01, T02 | pass |
| FR-03 | P0 | Governed read needs parent USE + SELECT; MANAGE/owner/admin for grants; audited allow/deny with explanation | T01, T02, T05 | pass |
| FR-04 | P0 | Table/column lineage from trusted pipeline events; bounded upstream/downstream impact; reject unknown assets | T04 | pass |
| FR-05 | P1 | Row predicates + column masks from a safe policy DSL; tenant isolation; authorization-filtered discovery | T03 | pass |
| Test | What it proves | Result |
|---|---|---|
| T01 | SELECT without parent USE denied; group grants allow; revoke grant or membership -> next read denied; explain trace | pass |
| T02 | Unauthorized grant, forged user, self-membership/self-grant, MANAGE re-delegation; invalid grant rolls back atomically | pass |
| T03 | Two tenants read the same table: own rows only, masked columns, PII group, auditor exception, projection never leaks | pass |
| T04 | Lineage DAG with a cycle, bounded traversal, upstream/downstream impact with hidden-asset redaction, invalid edges | pass |
| T05 | Bad policy operators/masks, storage path escape, audit store failure -> reads fail closed | pass |
Benchmark
| Target (hypothesis from the spec) | Goal | Actual | |
|---|---|---|---|
| p95 authorization < 20 ms on local machine (provisional) | < 20 ms | 0.114 ms | met |
| 100% deny on negative fixtures | 200/200 | 200/200 | met |
| revocation effective on the next request | allow -> deny | True -> False | met |
| lineage/grant indexes speed up impact queries (auth difference is noise at this scale) | impact faster | auth 0.114 vs 0.139 ms; impact 4.16 vs 7.63 ms unindexed | met |
auth_p95_ms= 0.114unindexed_auth_p95_ms= 0.139sql_per_decision= 15.8
quick run · 2026-11-28T23:57:39+00:00
Design questions
Why require USE on parents in addition to SELECT?
Containers gate discovery and access for everything inside them: an admin can revoke a whole schema with one USE grant without touching every table grant.
How do you make permission decisions explainable?
Evaluate as a list of explicit checks (identity, USE_CATALOG, USE_SCHEMA, SELECT) each recording the grant/ownership that satisfied it or why it failed, and audit that trace with the policy revision.
Why not cache authorization decisions?
Stale caches break immediate revocation. Cache only immutable structure (hierarchy) or version caches by policy revision.
Where must row filters and masks be enforced?
In the single governed read path, before results are returned, building output rows from projected masked values only - direct file access bypasses it, so storage must be isolated.
Can lineage leak information?
Yes - names, counts and edges of hidden assets are side channels. Redact names and document what counts remain visible.
Limitations
- Educational privilege model, not Databricks UC semantics
- Nested groups, ABAC language, SQL rewriting not supported
- Direct file access bypasses enforcement (fixture files isolated)
Run it
git clone https://github.com/ravirs/warden.git && cd warden
pip install -r requirements.txt
PYTHONPATH=src python -m miniuc demo # demo
PYTHONPATH=src python -m pytest -q # test
PYTHONPATH=src python benchmarks/bench.py --quick # benchMore systems I've built from scratch
Storage & data systems
- Strata LSM-tree key-value storage engine: WAL, SSTables with Bloom filters, atomic manifest, compaction
- Tidelog Kafka-style durable partitioned log broker: CRC'd records, offsets, generation-fenced consumer groups
- Floe Iceberg-style table format: immutable Parquet, manifests, snapshots, time travel, compare-and-swap commits
- Flint Spark-style batch engine: lazy lineage, stage planning, shuffles, broadcast and salted skew joins
- Watermark Event-time stream processor: windows, watermarks, lateness, exactly-once checkpoints
- SnapshotDB MVCC transaction engine: snapshot isolation, the write-skew anomaly, a serializable mode
AI infrastructure
- Nearline HNSW-style vector search index from scratch, measured against exact search
- KVPager Paged KV cache with copy-on-write forks and prefix reuse (PagedAttention-style)
- Batchwise LLM inference scheduler simulator: static vs continuous vs chunked-prefill batching
- Steadyhand Durable AI agent runtime: allowlisted tools, approvals, budgets, crash recovery, replay
- Toolgate Model Context Protocol gateway: curated tools, signed identity, tenant policy, approvals, audit