All my work / Storage & data systems · by Ravindra Sawant

Warden

Data governance catalog: explainable grants, row filters, column masks, lineage impact.

Python 3.11+ · SQLite · csv 509 lines of core code source on GitHub ↗ CI status

4/4 core requirements 5 tests passing 4/4 benchmark targets

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

ReqPriRequirement Proven byStatus
FR-01P0Catalogs/schemas/tables/columns with stable IDs, owners, tags, storage refs; FQN resolution; unique namesT02, T05pass
FR-02P0Users, groups, membership; grant/revoke USE_CATALOG/USE_SCHEMA/SELECT/MANAGE with defined inheritanceT01, T02pass
FR-03P0Governed read needs parent USE + SELECT; MANAGE/owner/admin for grants; audited allow/deny with explanationT01, T02, T05pass
FR-04P0Table/column lineage from trusted pipeline events; bounded upstream/downstream impact; reject unknown assetsT04pass
FR-05P1Row predicates + column masks from a safe policy DSL; tenant isolation; authorization-filtered discoveryT03pass
TestWhat it provesResult
T01SELECT without parent USE denied; group grants allow; revoke grant or membership -> next read denied; explain tracepass
T02Unauthorized grant, forged user, self-membership/self-grant, MANAGE re-delegation; invalid grant rolls back atomicallypass
T03Two tenants read the same table: own rows only, masked columns, PII group, auditor exception, projection never leakspass
T04Lineage DAG with a cycle, bounded traversal, upstream/downstream impact with hidden-asset redaction, invalid edgespass
T05Bad policy operators/masks, storage path escape, audit store failure -> reads fail closedpass

Benchmark

Target (hypothesis from the spec)GoalActual
p95 authorization < 20 ms on local machine (provisional)< 20 ms0.114 msmet
100% deny on negative fixtures200/200200/200met
revocation effective on the next requestallow -> denyTrue -> Falsemet
lineage/grant indexes speed up impact queries (auth difference is noise at this scale)impact fasterauth 0.114 vs 0.139 ms; impact 4.16 vs 7.63 ms unindexedmet
  • auth_p95_ms = 0.114
  • unindexed_auth_p95_ms = 0.139
  • sql_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   # bench

More 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

Distributed systems

  • Quorum Deterministic Raft consensus simulator with fault injection and an always-on invariant checker
  • Tandem Collaborative text editor on a sequence CRDT: offline edits, any delivery order, always converges
  • Burrow Minimal Linux container runtime in Go: namespaces, pivot_root, cgroup v2 limits

← See all my work: apps, ML/AI and systems