Repository navigation
sqlguardllm 0.5.0a3
Pre-release
Pre-release
Security release: upgrade if you use dialect="mysql" with hidden or masked columns.
Security
- On MySQL, hidden and masked columns could be read by writing the column name in another case. MySQL ignores the case of column names, quoted or not, but sqlglot's MySQL dialect is case-sensitive (because MySQL table names can be), so with
customers.emailhiddenSELECT EMAIL FROM customerswas allowed, and a maskedPHONEwas neither masked nor refused outside the select list. Hidden and masked columns are now matched case-insensitively in every dialect, which can only reject or mask more. Affects 0.1.0a1 to 0.5.0a2 withdialect="mysql": upgrade. Found by the new fuzzer (#62).
Added
sqlguardllm testchecks declared policy cases and reports results as text or JUnit XML (#66).examples/roles-tests.yamltests every role of the demo policy set, next toexamples/policy-tests.yamlfor the demo policy. CI runs both and lints the demo policies with--strict(#66, #67).sqlguardllm lintwarns about policies that are valid but probably unsafe, with stable codes:no-table-allowlist,tenant-without-row-filter,sensitive-column-exposed,max-rows-disabled,max-rows-high(above 10000 or--max-rows-threshold),aggregate-k-low(k below 5) anddenied-function-allowed. Each warning has an explanation, a fix and a link to its field in the policy reference, in English or Spanish (--language), as text or JSON (--format). Policy sets are linted role by role. The column checks read the policy'sschemaand are reported as skipped without it.--strictexits 1 on warnings (#67).- Policy key
lint_suppress: {code: reason}silences a reviewed lint warning, and the report shows the reason. It is in the policy and policy-set JSON Schemas, unknown codes and blank reasons are rejected, roles inherit and extend it, and checking SQL ignores it (#67). - Property-based fuzzing of the guard, judged by executing every allowed query on canary data (
tests/fuzz/,hypothesis): no value of another role's rows or of a hidden or masked column in the output, the same rows when only secrets change, never more thanmax_rows, no exception fromcheck(), and idempotence. 300 examples on SQLite and DuckDB in every pull request; 20,000 every night on PostgreSQL 16, MySQL 8, SQL Server 2022, DuckDB and SQLite. Failures are minimised intotests/corpus/fuzz_regressions.yaml; statistics inresearch/results/fuzz.json; the oracle and its limits indocs/THREAT_MODEL.md. It also found that DuckDB 2.0.1 drops theLIMITof someLEFT JOINqueries, so theremax_rowsdepends on the engine (#62).
Fixed
check()raised instead of rejecting on some malformed input:RecursionErrorfor deeply nested SQL (thousands of parentheses), andTypeErrorfrom sqlglot's argument checks, which are on wheneverunittestorpytestis imported (a T-SQL query whose nested comments leaveLENwith two arguments). Any such error while parsing is nowparse_error. Found by the fuzzer (#62).