PYPI PACKAGE AUDIT v0.1.0a2 Salud Empresarial

sqlguardllm

El firewall SQL para aplicaciones LLM: valide SQL escrito por AI y reescríbalo como de solo lectura, incluido en la lista de permitidos, filtrado por filas y limitado.

PyPkgScore sqlguardllm
Metodología y Criterios ♥ Donate
955 / 1000
Instalación Rápida
pip install sqlguardllm
1. Gobernanza
200/200
2. Metadatos PEP
200/200
3. Seguridad
200/200
4. Docs y SEO
155/200
5. Ingeniería CI
200/200
📣 Compartir Auditoría: Comparte este informe y la vista previa en el idioma actual
Advertisement
TELEMETRÍA PYPI

Descargas y Adopción en la Comunidad

Últimos 30 días (sin espejos)
Últimos 7 días
162
Últimos 30 días
162
Total (180 días)
162
Métrica / Ecosistema Estado / Valor Fuente
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 955 / 1000 PyPkgScore Engine

Análisis de Salud e Ingeniería (5 Pilares)

1. Gobernanza y Comunidad200 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✓ 50 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✓ 50 pts
2. Metadatos y Empaquetado PEP200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Seguridad y Cadena de Suministro200 / 200 ▾
Cero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
Repositorio HTTPS✓ 50 pts
4. Documentación, SEO y Ecosistema155 / 200 ▾
README Estructurado✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
Sitio Web / Artículos Técnicos✓ 45 pts
5. Ingeniería, CI y Calidad200 / 200 ▾
Pruebas Automatizadas✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✓ 35 pts
Advertisement
README & DOCS

Documentación Oficial y Guía de Uso — sqlguardllm

PyPI Metadata v0.1.0a2
Mostrar documentación original completa (README en inglés) ▾

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, EXEC or row locks, at any depth. A DELETE hidden 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.*, DuckDB read_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

The distribution is named sqlguardllm on PyPI; the import name is sqlguard. Licensed under Apache-2.0.