Open
Conversation
Fix three audit findings in the query validator: 1. Critical: GROUP BY GROUPING SETS clause skipped function allowlist. Expressions inside GROUPING SETS modifiers (and GROUP BY ALL modifiers) were not validated, allowing set_config() session poisoning. 2. High: Aggregate argument ORDER BY clause skipped function allowlist. Function calls inside ORDER BY within aggregate args (e.g. string_agg(x, ',' ORDER BY set_config(...))) were not validated. 3. High: lpad/rpad/repeat with large length arguments allowed memory exhaustion DoS. Added validation capping length args at 100,000. Amp-Thread-ID: https://ampcode.com/threads/T-019d458d-01b9-76ca-9fb1-ab93d421fa53 Co-authored-by: Amp <amp@ampcode.com>
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.
Fix three audit findings in the query validator:
1. GROUP BY GROUPING SETS Skips Function Allowlist
Expressions inside
GROUPING SETSmodifiers (andGROUP BY ALLmodifiers) were not validated, allowingset_config()session poisoning via:2. Aggregate Argument ORDER BY Skips Function Allowlist
Function calls inside
ORDER BYwithin aggregate arguments were not validated:3. Ipad/rpad/repeat Memory Exhaustion DoS
lpad(),rpad(), andrepeat()with large length arguments could allocate unbounded memory. Added a 100,000 cap on the length argument:All three bypasses now have unit tests verifying rejection and that normal usage still works.