fix: improve extraction engine, validation mechanisms and security#7
Merged
Merged
Conversation
Consolidate duplicate WHERE clause validation, fix NULL filtering inconsistency in FK traversal, add seed cardinality limits, fix Decimal precision loss in JSON output, type ExtractionResult fields, and refactor streaming deferred updates to use chunked fetching. Additionally addresses five previously unimplemented review findings: - Use \N sentinel for NULL in CSV output to distinguish from empty string - Raise error when passthrough table has no primary key (was silent skip) - Add --statement-timeout CLI flag for PostgreSQL query timeout - Validate anonymizer provider names at configure time (catch typos) - Add post-extraction compliance manifest validation BREAKING CHANGE: JSON output now serializes Decimal values as strings (e.g., "99.99") instead of floats to preserve exact precision. CSV output now uses \N for NULL values instead of empty string. Passthrough tables without a primary key now raise an error instead of being silently skipped.
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.
--allow-unsafe-wherewith proper validation inconfig.py, butinput_validators.pykept its own weaker regex copy. Patching one would leave the other vulnerable.input_validatorsnow delegates toconfig.py.hipaa_zip3,year_only, etc) but typos likehipaa_zip_3silently fell back to generic Faker output. Provider names are validated atconfigure()time now.ExtractionErrornow. (breaking)fetch_referencing_pkswasn't filtering NULL FK values whilefetch_fk_valueswas, same adapter two behaviors. Aligned them.--statement-timeoutandstatement_timeout_msconfig, defaults to 0.Decimalwithfloat(), which rounds large financial values. Switched tostr(). Downstream gets"99.99"not99.99. (breaking)\Nnow per PostgreSQL COPY convention. (breaking)status='pending'on a big table would load the whole thing. Added--max-seed-rows, 10K default, warns at 1K.list(fetch_by_pk(...))for broken FK tables, which defeats the point. Usesfetch_by_pk_chunkednow._extract_fk_valuesusedrow.get(col), quietly turning missing columns intoNone. Usesrow[col]so it blows up.ExtractionResulthadlist[Any]forbroken_fks,deferred_updates,cycle_infos,profiler. Typed properly.Breaking changes:
Decimalvalues are now strings, not floats. DoDecimal(row["amount"])instead of assuming a number.\Ninstead of empty string. Set your importer to treat\Nas NULL.