Stability policy (1.x)
From 1.0.0, sqlguardllm follows Semantic Versioning. This page says exactly what that promises. Español.
Short version: the guard API, the violation codes, the policy file schema, the CLI commands and the HTTP protocol v1 do not break before 2.0. Anything marked experimental, and the wording of messages, can change in a minor release.
What is stable in 1.x
Within 1.x nothing below is removed, renamed or changed in a way that makes correct existing code or policies stop working.
| Surface | What is covered |
|---|---|
| Python API | Every name in sqlguardllm.__all__ that api.md lists, and its documented members: Guard (check, enforce, explain, wrap), Policy (fields, from_dict, from_file), CheckResult, Violation, ViolationCode, Explanation, GuardViolation, PolicyError, PolicySet, FunctionPolicy, AuditLog, AuditEvent, __version__. Parameters and fields keep their names, types and meaning. |
| Decisions | CheckResult.ok, codes and tables for a given SQL, policy and context do not change in a way that accepts more, except through the security rules below. The rewritten sql still satisfies the policy; its exact text is not promised (formatting of the generated SQL may change). |
| Violation codes | The stable codes (below). |
| Policy file schema | The keys, types and meaning of schema/policy.schema.json (what sqlguardllm schema prints), in YAML and JSON. A 1.0 policy loads and means the same in every 1.x release. New keys are optional. |
| CLI | sqlguardllm check, test, lint and schema: command names, flags, input formats and exit codes. New flags and new lint warning codes can be added. |
| HTTP server | Protocol v1 under /v1, documented in SERVER.md and PROTOCOL.md (the engine stdio protocol, hello.protocol = 1). Changes inside v1 are additive only; clients must ignore unknown response fields. Anything else needs /v2 and a major release. |
| Node.js and .NET clients | The public API of sqlguardllm on npm and SqlGuardLlm on NuGet that mirrors the above: SqlGuard/ISqlGuard check, enforce, explain, wrap, options, CheckResult, Violation, GuardViolation. Packages share one version (see packages). Behavior is held equal to Python by the conformance suite. |
Stable violation codes
parse_error, empty_statement, multiple_statements, not_a_query, write_operation, row_lock, table_not_allowed, hidden_column, denied_function, missing_context, invalid_context, too_complex, missing_required_filter, aggregate_required, audit_failure.
Codes are strings. They are the part of a result you may branch on. The set is pinned by tests/test_public_api.py.
What is not covered
These may change, or be removed, in any minor release. Each is marked in its docstring and in api.md with the same note:
Experimental: not covered by the 1.x stability guarantee (see STABILITY.md); it may change in a minor release.
Policy.from_databaseand thesqlguardllm[db]extra.- Proxy mode (
sqlguardllm proxy). sqlguardllm doctorand thesqlguardllm.doctormodule.- Controlled writes:
Policy.writes,WritePolicy,TableWrites,Guard.check_write,WriteCheckResult, and the codeswrite_not_allowed,write_column_not_allowed,missing_where,too_many_rows. - Stored procedures:
Policy.proceduresand the codesprocedure_not_allowed,procedure_param_invalid. - Tainted sessions:
untrusted_columns,sensitive_tables,on_taintedand the codetainted_session. - Verified queries (
sqlguardllm.catalog,sqlguardllm mcp --catalog, the toolslist_verified_queriesandrun_verified_query,sqlguardllm catalog check, thecatalog_queryandcatalog_versionaudit fields, CATALOG.md). - Plan checks (
sqlguardllm.plan,PlanGuard,sqlguardllm mcp --plan-full-scanand--plan-on-exceed, PLAN_CHECKS.md). - Policy diff (
sqlguardllm.policy_diff,sqlguardllm diff, POLICY_DIFF.md). - Sensitive data classes:
Policy.data_classes,Policy.column_classes,Policy.not_sensitive,Explanation.data_classes,sqlguardllm.classesandsqlguardllm classify(CLASSES.md). - Query advice:
Policy.advice,Explanation.advice,sqlguardllm.advice,sqlguardllm check --adviceand the codelow_query_score(ADVICE.md). - Shadow mode (
sqlguardllm.shadow,ShadowGuard,sqlguardllm shadow, SHADOW.md). - The red team (
sqlguardllm.redteam,sqlguardllm redteam, REDTEAM.md). - MCP server: the core
querytool is stable; extra tools and extra result fields are not. - The benchmark harness (
sqlguardllm.bench,benchmarks/) and the demo, playground and research code. - Wording:
Violation.message,Explanationtext and the English/Spanish catalogs. Usecode, never the text, for logic. - Log formats: audit log and server log lines. The audit event fields documented in AUDIT.md are only added to.
- Anything underscore-prefixed or in a module not exported from
sqlguardllm(such assqlguardllm.guardinternals).
The codes of experimental features keep their spelling, but when and how they are produced is part of the experiment. When a feature leaves the experimental list, that is a minor release with a changelog entry, and it is then covered.
SemVer rules {#semver}
| Change | Release |
|---|---|
| Remove or rename a stable name, field, flag, policy key, protocol field or code; change a signature incompatibly; make documented behavior different | major |
| Add an API, option, optional policy key, CLI flag, response field or violation code; promote an experimental feature; widen the supported sqlglot range | minor |
| Bug fix, performance, documentation, a security fix (below) | patch |
| Change anything experimental | minor (or patch) |
Python uses PEP 440 and npm/NuGet use SemVer spelling for prereleases; the three packages always release the same version.
Deprecation policy
A stable API is deprecated before it is removed. A deprecated API keeps working and emits a warning (DeprecationWarning in Python, the equivalent in the other clients) for at least one full minor release, is listed in the changelog under "Deprecated" with the replacement, and is removed only in the next major release. Deprecating never changes behavior.
New violation codes
Adding a code is a minor release: a new rule can reject SQL with a new reason. Consumers must treat an unknown code as a rejection (the guard fails closed) and show its message. Renaming or removing a stable code is a major release. A query that was rejected keeps being rejected with the same code, though it may gain additional codes in violations.
Security fixes {#security}
A guard exists to refuse dangerous SQL. When a bypass is found, the fix makes the guard stricter, and it ships as a patch release even if it rejects SQL that was previously allowed. Rationale: SQL that the fix now rejects was a hole, not a feature, and holding a security fix back for a minor release leaves users exposed. We apply the fix as narrowly as we can, add the case to the adversarial corpus, and label the changelog entry Security (stricter) so you can see which patch changed a decision. If a fix needs a new violation code or a changed policy key, it still ships as a patch when it only tightens, and the details are in the advisory (SECURITY.md). A fix that makes the guard reject less (a false positive) is a patch only when it cannot admit anything the policy meant to block.
sqlglot support policy {#sqlglot}
sqlglot is the only runtime dependency, and parsing differences are security relevant, so the range is pinned in pyproject.toml and this policy describes how it moves, not which versions are in it today.
- Supported: the sqlglot major versions inside the declared range, in one major at a time unless a release note says otherwise. We test the range's lower and upper bounds.
- Following new majors: we start testing a new sqlglot major soon after it is released, and aim to support it within one to two minor releases of ours. We do not widen the range for a sqlglot major that has not passed our tests.
- What must pass before a bump: the full adversarial corpus, the conformance suite and the fuzz suites, with no new accepted-dangerous results and no unexplained decision changes. Differences are reviewed one by one.
- Release type: raising or widening the range for a new sqlglot major is a minor release once those suites pass. Dropping support for an old sqlglot major is also a minor release, announced as a deprecation first.
- Security: if a sqlglot change opens a bypass, we narrow the range or fix our side in a patch release, under the security policy above.
- Embedding: libraries that depend on sqlguardllm should accept the declared range and not pin sqlglot tighter. The current range is in
pyproject.toml; see embedding and compatibility.
How the contract is enforced
tests/test_public_api.pycompares__all__, the signatures ofGuardandPolicy, the fields ofCheckResultandViolation, and the violation codes withtests/data/public_api.json. A deliberate change regenerates the snapshot (SQLGUARD_UPDATE_API_SNAPSHOT=1 uv run pytest tests/test_public_api.py) and shows up in review.- The policy schema, the HTTP and stdio protocols, and the Node and .NET clients are held to the same results by the conformance suite.