Skip to content

sqlguardllm 0.5.0a4

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 27 Nov 03:46
· 30 commits to main since this release
7ee89a8

Security release: upgrade if you use dialect="duckdb" with hidden or masked columns. It also brings the embedded-engine groundwork (engine protocol, standalone binaries, npm and NuGet engine packages), the opt-in audit log and the LLM red team.

Security

  • On DuckDB, hidden and masked columns could be read with COLUMNS('regex') or COLUMNS(lambda). DuckDB picks the columns by pattern at run time, and the guard did not treat it as a star, so SELECT COLUMNS('.*') FROM customers returned a hidden column. COLUMNS() is now refused whenever the query can see a table with hidden or masked columns (also inside an aggregate). Affects every release with dialect="duckdb". Found by the LLM red team (#63).

Added

  • LLM red team (#63): research/redteam/run.py asks Claude (claude-opus-5-5, adaptive thinking, structured outputs, server-side fallback) for attacks against the guard, with a fixed defensive-purpose prompt (prompt.md, sha256 recorded). Every query is kept in research/redteam/<date>/attacks.jsonl with model, prompt and policy hashes, version, git sha, verdict and per-engine outcome, judged by the fuzzing canary oracle on SQLite, DuckDB, PostgreSQL, MySQL and SQL Server; duplicates are fingerprinted and counted, bypasses become pending cases for tests/corpus/redteam.yaml. A run is capped (at most 50 attacks, a hard token budget, a per-run USD ceiling checked against a free token count first); a refusal is recorded, not a failure. --rescore <dir> re-judges a stored dataset without the API. Weekly and manual workflow .github/workflows/redteam.yml on main only.
  • .NET: the engine as runtime assets of the NuGet package (#76). SqlGuardEngine.StartAsync(policy) runs the packaged runtimes/{rid}/native/sqlguardllm-engine/ for linux-x64, linux-arm64, osx-x64, osx-arm64 and win-x64 over the stdio protocol, after recomputing the SHA-256 of every file against engine.sha256 (a mismatch, a missing file or a wrong engine version or protocol refuses to run). An unsupported runtime (other OS or CPU, musl) fails with engine_unsupported, which names remote mode (SqlGuardClient). clients/dotnet/build/stage-engines.py stages the output of fetch-engine.py and fails when the .nupkg passes 150 MB.
  • Standalone engine binaries for linux-x64, linux-arm64, macos-arm64, macos-x64 and windows-x64 (#69): PyInstaller one-dir builds of engine --stdio (sqlguardllm, sqlglot and the standard library only) built by scripts/build-engine.py on a native runner each and accepted only after hello and the full conformance corpus pass over stdio (.github/workflows/engine-binaries.yml, also on every pull request touching the engine). Size, cold start and memory in benchmarks/engine-binaries.json.
  • Release pipeline for the binaries (#70): on every v* tag the five archives and SHA256SUMS are attached to the GitHub Release from the same commit as the PyPI release, with build provenance attestations (gh attestation verify); the registries publish only after all binaries passed. scripts/fetch-engine.py <version> downloads and verifies them (checksums, attestations, lockstep version) and fails on any mismatch. Asset names, verification and the client version rule (refuse an engine with another major or protocol version) are in docs/PROTOCOL.md.
  • sqlguardllm engine --stdio: the engine as a child process over newline-delimited JSON (protocol version 1: hello, load_policy, check, explain, shutdown), with the same check and explain bodies as the HTTP server, described by schema/protocol/protocol.schema.json and docs/PROTOCOL.md. The conformance corpus runs over it (#68).
  • Opt-in audit log of every decision, off by default (#65). Guard(policy, audit=AuditLog(...)) or any callable taking an AuditEvent; sinks for a JSON Lines file, stderr, logging and OpenTelemetry (sqlguardllm[otel]). Events carry the timestamp, id, version, policy fingerprint, role, outcome, violation codes, tables, normalised-SQL fingerprint, duration and the names of the context keys, never their values. include_sql is redacted (default, literals replaced by ?), none or raw. A failing sink never allows a rejected query; with strict=True it rejects the query with the new code audit_failure. CLI check, serve and mcp get --audit-log PATH|- and --audit-sql. See docs/AUDIT.md.