PYPI PACKAGE AUDIT
v0.1.0a2
Enterprise-konform
sqlguardllm
Die SQL-Firewall für LLM-Apps: Validieren Sie von KI geschriebenes SQL und schreiben Sie es schreibgeschützt, auf die Zulassungsliste gesetzt, zeilengefiltert und eingeschränkt um.
955
/ 1000
Schnellinstallation
pip install sqlguardllm
1. Governance
200/200
2. PEP-Metadaten
200/200
3. Sicherheit
200/200
4. Doku & SEO
155/200
5. CI-Engineering
200/200
📣 Prüfung teilen:
Teilen Sie diesen Bericht und die Vorschau in der aktuellen Sprache
PYPI-TELEMETRIE
Downloads & Community-Verbreitung
Letzte 30 Tage (ohne Spiegelserver)
Letzte 7 Tage
162
Letzte 30 Tage
162
Gesamt (180 Tage)
162
Gesundheits- & Engineering-Analyse (5 Säulen)
1. Governance & Community200 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✓ 50 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✓ 50 pts
2. PEP-Metadaten & Paketierung200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Sicherheit & Lieferkette200 / 200 ▾
Null CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS-Repository✓ 50 pts
4. Dokumentation, SEO & Ökosystem155 / 200 ▾
Strukturierte README✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
Webseite / Fachartikel✓ 45 pts
5. Engineering, CI & Qualität200 / 200 ▾
Automatisierte Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✓ 35 pts
README & DOCS
PyPI Metadata v0.1.0a2
Offizielle Dokumentation & Nutzungsleitfaden — sqlguardllm
Vollständige Originaldokumentation anzeigen (Englisches README) ▾
sqlguard — the SQL firewall for LLM apps
Your model writes SQL. sqlguard makes sure it can only read what it's allowed to read: one read-only statement, allowlisted tables and columns, row-level filters per user, and a row limit, in any dialect sqlglot understands.
pip install sqlguardllm
from sqlguard import Guard, Policy
guard = Guard(
Policy(
dialect="postgres",
tables={"invoices", "branches", "customers"},
hidden_columns={"customers.email"},
row_filters={"invoices": "branch_id IN ({user.branches})"},
max_rows=1000,
)
)
result = guard.check(sql_from_llm, context={"user": {"branches": [1, 2]}})
if result.ok:
rows = db.execute(result.sql) # read-only, row-filtered, limited
else:
print(result.messages) # ["The query tries to change data or structure (DELETE)"]
What it guarantees
- One statement that is a query. Nothing stacked after a
;. - Read-only across the whole syntax tree: no
INSERT,UPDATE,DELETE,MERGE,SELECT … INTO, DDL,COPY,ATTACH,PRAGMA,EXECor row locks, at any depth. ADELETEhidden in a CTE is caught. - Allowlisted tables and hidden columns, CTE-aware;
SELECT *, whole-row references and predicates on hidden columns are rejected. - Denied functions per dialect: file readers, sleeps, shells, network calls and functions that run SQL from a string (
pg_read_file,query_to_xml,LOAD_FILE,OPENROWSET,DBMS_PIPE.*, DuckDBread_csv…). - Row-level filters: every occurrence of a table becomes a filtered derived table, with the user's values bound as escaped literals.
- Row limit in the dialect's own syntax (
LIMIT,TOP,FETCH FIRST). - Fails closed: what can't be understood is rejected with a reason.
Pure Python, one dependency (sqlglot), no network, no LLM. Status: alpha — the API may still change before 1.0; violation codes are stable.
Learn more
- Source, design and attack gallery: https://github.com/jmmana/sqlguard
- Threat model: https://github.com/jmmana/sqlguard/blob/main/docs/THREAT_MODEL.md
- Report a bypass privately: https://github.com/jmmana/sqlguard/security/advisories/new
The distribution is named sqlguardllm on PyPI; the import name is sqlguard. Licensed under Apache-2.0.