Repository navigation
sqlguardllm 0.5.0a4
Pre-release
Pre-release
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')orCOLUMNS(lambda). DuckDB picks the columns by pattern at run time, and the guard did not treat it as a star, soSELECT COLUMNS('.*') FROM customersreturned 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 withdialect="duckdb". Found by the LLM red team (#63).
Added
- LLM red team (#63):
research/redteam/run.pyasks 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 inresearch/redteam/<date>/attacks.jsonlwith 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 fortests/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.ymlonmainonly. - .NET: the engine as runtime assets of the NuGet package (#76).
SqlGuardEngine.StartAsync(policy)runs the packagedruntimes/{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 againstengine.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 withengine_unsupported, which names remote mode (SqlGuardClient).clients/dotnet/build/stage-engines.pystages the output offetch-engine.pyand fails when the.nupkgpasses 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 byscripts/build-engine.pyon a native runner each and accepted only afterhelloand 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 inbenchmarks/engine-binaries.json. - Release pipeline for the binaries (#70): on every
v*tag the five archives andSHA256SUMSare 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 indocs/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 samecheckandexplainbodies as the HTTP server, described byschema/protocol/protocol.schema.jsonanddocs/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 anAuditEvent; sinks for a JSON Lines file, stderr,loggingand 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_sqlisredacted(default, literals replaced by?),noneorraw. A failing sink never allows a rejected query; withstrict=Trueit rejects the query with the new codeaudit_failure. CLIcheck,serveandmcpget--audit-log PATH|-and--audit-sql. Seedocs/AUDIT.md.