Skip to main content

Immutable Database Proxy — turns any database into a cryptographically verifiable ledger with TIBET provenance

Project description

tibet-db — Immutable Database Proxy

Every query gets a TIBET token. No exceptions.

No blockchain nonsense, just crypto + provenance.

tibet-db is a proxy that sits between your application and your database. Every SQL/NoSQL query is intercepted and receives a cryptographically verifiable TIBET provenance token. This turns any legacy database into an immutable, auditable ledger — without changing a single line of application code.

Architecture

[App] --SQL--> [tibet-db proxy] --SQL--> [PostgreSQL/MongoDB]
                    |
               TIBET token
               ├── ERIN:      the query itself, query type, affected tables
               ├── ERAAN:     caller JIS identity, connection info
               ├── EROMHEEN:  timestamp, proxy node, database target
               └── ERACHTER:  intent/context provided by caller

Every query — SELECT, INSERT, UPDATE, DELETE, DDL — gets a token. Dangerous queries (DROP TABLE, DELETE without WHERE) are blocked or flagged by policy.

Use Cases

  • Forensics after a hack — "Show me every query from this IP in the last 72 hours"
  • Compliance audit — Prove who changed what, when, and why
  • Mutation tracking — Full history of every write operation with provenance
  • Policy enforcement — Block DROP TABLE in production, alert on DELETE without WHERE

Install

pip install tibet-db

Quick Start

from tibet_db import QueryProxy, QueryPolicy

proxy = QueryProxy(database_target="postgresql://localhost/mydb")

# Intercept a query
record = proxy.intercept(
    query="SELECT * FROM users WHERE id = 42",
    caller_id="jis:backend-api:v2.1",
    context={"endpoint": "/api/users/42", "method": "GET"},
)
print(record.allowed)         # True
print(record.query_type)      # "SELECT"
print(record.tibet_token_id)  # "a3f8c1e2..."

# Block dangerous queries by default
record = proxy.intercept(
    query="DROP TABLE users",
    caller_id="jis:dev-intern:session-7",
)
print(record.allowed)  # False — blocked by default policy

# Search query history
records = proxy.query_log(caller_id="jis:dev-intern:session-7")

# Forensics mode
suspicious = proxy.forensics(query_pattern="DROP|TRUNCATE|DELETE.*users")

Default Policies

tibet-db ships with three default policies:

Policy Targets Action Description
block-drop-table DDL BLOCK Blocks DROP TABLE / DROP DATABASE
alert-delete-no-where DELETE ALERT Flags DELETE without WHERE clause
alert-privilege-change DDL ALERT Flags GRANT / REVOKE statements

Add custom policies:

from tibet_db import QueryPolicy

proxy.add_policy(QueryPolicy(
    name="block-production-truncate",
    query_types=["DDL"],
    pattern=r"TRUNCATE\s+",
    action="BLOCK",
    description="No truncation in production",
))

CLI

tibet-db info          # Concept overview and architecture
tibet-db demo          # Interactive demo: queries, tokens, blocked DROP TABLE
tibet-db policies      # Show default security policies
tibet-db forensics     # Demo forensics mode (simulate post-hack investigation)

Why Not Just Database Logs?

Database logs tell you what happened. tibet-db tells you:

  1. Who — JIS-verified caller identity, not just a connection string
  2. What — The exact query, classified by type, with affected tables
  3. When — Cryptographically timestamped, not filesystem time
  4. Why — Application context: which endpoint, which user action, which intent

All four, chained together in a tamper-evident TIBET token.

License

MIT — Humotica AI Lab 2025-2026

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tibet_db-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tibet_db-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file tibet_db-0.1.0.tar.gz.

File metadata

  • Download URL: tibet_db-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_db-0.1.0.tar.gz
Algorithm Hash digest
SHA256 afce752004ac2f92786aaa89affd496c32ac54829736f670eabffd89592619c5
MD5 da88f93aac19ca515ef335e32b6afe44
BLAKE2b-256 67d1536fb4fdd961c3abcf9fc042b066690138828af29a67e66a8796d25ba032

See more details on using hashes here.

File details

Details for the file tibet_db-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tibet_db-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tibet_db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b50ff8e34da584f652a90aeac1ddd9ac41dbcfebf8c9df776ab20067e2b2bfa
MD5 da8f5350ec34425a042233cfd1393177
BLAKE2b-256 7568c4c9647cf413305c64967b943013b48a7c8f0c9bc317b74b5e063a29a3cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page