fix(security): prevent SQL injection, unbounded recursion, and condition DoS#71
Merged
Conversation
…ion DoS - Add SQL identifier validation to Postgres backend field_expr, resolve_table, and qualify_table_name to prevent injection via JSONB field paths and table/schema names - Convert deep_merge from recursive to depth-limited (MAX_DEPTH=64) with MergeTooDeep error variant to prevent stack overflow from crafted YAML input - Add 64KB length cap and depth counter (64) to condition parser to prevent DoS via oversized or deeply nested condition strings - Add regression tests for all three vulnerability classes
c78c56f to
3c8e980
Compare
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.
Summary
InvalidIdentifiererrors instead of interpolating untrusted strings into queriesdeep_mergeto an iterative implementation withMAX_DEPTH=64, returningMergeTooDeepon crafted YAMLConditionTooLongon oversized inputTest plan
field_expr_rejects_quote_in_field_name,resolve_table_rejects_quote_in_schema_name, etc.)deep_merge_handles_deeply_nested_globalverifies depth limit triggersdeep_merge_succeeds_at_reasonable_depthverifies normal operationcondition_too_long_returns_errorandmoderate_condition_still_parses