Skip to content

SQLGuard Ninja v0.3.0

Choose a tag to compare

@Pratik653 Pratik653 released this 24 Oct 17:24
· 12 commits to main since this release

SQLGuard Ninja v0.3.0

Enterprise policy-as-code and tenant enforcement.

Highlights

  • Role inheritance with sticky explicit denies: a child role can add permissions, but cannot undo an inherited deny. Conflicts, unknown parents and cycles fail at load time.
  • Review before activation: sqlninja policy diff classifies every change as relaxes / restricts / neutral (--fail-on-relaxation for CI). policy simulate --against shows decision changes on example queries, and policy explain traces effective access through the inheritance chain.
  • Auditability: every decision has a decision_id, the policy revision and fingerprint. Audit events add a correlation id, a literal-insensitive query fingerprint and a tenant-rewrite flag.
  • Templates: minimal, multi_tenant_saas, analytics_readonly.
  • Opt-in AST tenant-filter rewrite: missing tenant pins are added as bind-parameter predicates and the rewrite is re-validated. It is refused on any other problem or on RIGHT/FULL-join ownership ambiguity.

Compatibility

Existing policies behave as before; the new fields are optional.

Known limitations

  • All benchmark results are internal. There is no independent dataset yet (issue #6), and no restricted-function or system-catalog cases (issue #5).
  • The tenant rewrite emits sqlglot-normalised SQL. Database row-level security remains the authoritative tenant control.
  • Only PostgreSQL and SQLite are supported; writes are denied; no guarantee against SQL injection or data leakage.

Installation

python -m pip install sqlguard-ninja==0.3.0

PyPI: https://pypi.org/project/sqlguard-ninja/0.3.0/