Repository navigation
Finish #294: value sampling, validators, Spanish names, corpus, roles, threat model - #315
Merged
Merged
Conversation
…, threat model classify --sample N checks bounded, read-only samples of values (never printed) with email, Luhn, CURP, RFC, SSN, CLABE and IBAN checks. 130 corpus cases pin each class action in five dialects, role overrides are tested, and docs are corrected for #308. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #294.
Everything left in #294 after #309 (classes) and #313 (explanations, protocol and clients).
What it adds
classify --sample N(1–1000, off by default): also checks up to N values per column with an email shape, Luhn (cards), CURP, RFC, US SSN, the CLABE check digit and the IBAN mod-97. A class is proposed when ≥80% of at least 3 sampled values pass. Each proposal says whether name, values or both support it, sonetwork_docs.rfc_numbershows as name only (values did not confirm it) andcustomers.contactis found as values only.--sample; oneSELECT … WHERE col IS NOT NULL LIMIT Nper column, never more than 1000 values (the CLI rejects more, and the function clips as a second defence) and 500 columns; the transaction is read-only (PRAGMA query_onlyon SQLite is verified to block anINSERT; PostgreSQL and MySQL also set a 5 s timeout) and rolled back; sampled values are never printed, in YAML or JSON; columns the--policyalready decides are not sampled.tarjeta,numero_cuenta,pasaporte,imss…). Found by the tests: Spanish puts the descriptive word first (tipo_tarjeta,estado_tarjeta,fecha_curp), so the rule that only looked at the last word flagged them; fixed and tested.tests/corpus/data_classes.yaml) for every class action in PostgreSQL, MySQL, T-SQL, SQLite and Snowflake: alias,LOWER,CONCAT,CAST,COALESCE,CASE, window, CTE,UNION, and leaks throughWHERE,GROUP BY,ORDER BYandJOIN. Their expectations come from the explicit-policy equivalent, which the generator asserts is identical to the class policy.conformance/cases.jsonis regenerated, so the Node.js (66) and .NET (67) conformance suites run them too, locally green.add:to change a class action, a role replacing the classes) and the docs warn that a role settingcolumn_classesreplaces the inherited ones.docs/REDTEAM.md(EN/ES) said the dbhub test runs in CI. The owner excluded the active red-team modules from default CI in Exclude active red-team modules from default CI #308 (a decision I respect and did not touch), so the docs now say how to run it by naming the file.Tested
New tests in
tests/test_data_classes.py(validators, thresholds, Spanish names with false positives, the five sampling guarantees, role overrides) plus the corpus. Full suite, ruff, mypy and a strict docs build pass locally, as do the Node.js and .NET conformance suites.tests/engines/test_classify_engines.pyruns the sampler on a real PostgreSQL (checked locally on PostgreSQL 17 and in the Engines job): values are classified,transaction_read_onlyis on,statement_timeoutis 5 s, aDELETEis refused and the CLI prints no value or password.Not done
🤖 Generated with Claude Code