Skip to content

fix: Query condition depth bypass via pre-validation transform pipeline (GHSA-9fjp-q3c4-6w3j)#10257

Merged
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/GHSA-9fjp-q3c4-6w3j-v9
Mar 20, 2026
Merged

fix: Query condition depth bypass via pre-validation transform pipeline (GHSA-9fjp-q3c4-6w3j)#10257
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/GHSA-9fjp-q3c4-6w3j-v9

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 20, 2026

Issue

Query condition depth bypass via pre-validation transform pipeline (GHSA-9fjp-q3c4-6w3j)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Mar 20, 2026

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement.

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

This change addresses a security vulnerability (GHSA-9xp9-j92r-p88v) by implementing query depth validation to prevent stack overflow from deeply nested logical operators. A new validateQueryDepth() method is added to enforce maximum nesting limits for $and, $or, and $nor operators, with corresponding test coverage for rejection and acceptance scenarios.

Changes

Cohort / File(s) Summary
Query depth validation tests
spec/vulnerabilities.spec.js
Added four test cases validating queryDepth enforcement: rejection of deeply nested $and and $nor queries with "nesting depth exceeds maximum" error, REST API GET request validation returning Parse.Error.INVALID_QUERY, and a positive control confirming nested queries are allowed within depth limits (queryDepth: 10).
Query depth validation implementation
src/RestQuery.js
Added validateQueryDepth() method that recursively traverses restWhere to enforce config.requestComplexity.queryDepth limits across $or, $and, and $nor operators. Integrated into execute() control flow to validate early, bypassing checks for master/maintenance auth and skipping when validation is disabled (queryDepth === -1).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description provided by the author, missing all required sections from the template including Issue, Approach, and Tasks. Add a comprehensive description following the template: include the security issue reference, describe the queryDepth validation approach, and check off completed tasks (tests added, security checks applied).
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title directly references the security vulnerability (GHSA-9fjp-q3c4-6w3j) and clearly describes the main fix: preventing query condition depth bypass via pre-validation in the transform pipeline. This matches the changeset which adds queryDepth validation to RestQuery.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.54%. Comparing base (683e2ae) to head (d3ad2b3).
⚠️ Report is 2 commits behind head on alpha.

Files with missing lines Patch % Lines
src/RestQuery.js 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10257      +/-   ##
==========================================
+ Coverage   92.13%   92.54%   +0.40%     
==========================================
  Files         192      192              
  Lines       16399    16417      +18     
  Branches      221      221              
==========================================
+ Hits        15110    15193      +83     
+ Misses       1266     1205      -61     
+ Partials       23       19       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza changed the title fix: GHSA-9fjp-q3c4-6w3j v9 fix: Query condition depth bypass via pre-validation transform pipeline (GHSA-9fjp-q3c4-6w3j) Mar 20, 2026
@mtrezza mtrezza merged commit 85994ef into parse-community:alpha Mar 20, 2026
23 of 24 checks passed
parseplatformorg pushed a commit that referenced this pull request Mar 20, 2026
# [9.6.0-alpha.44](9.6.0-alpha.43...9.6.0-alpha.44) (2026-03-20)

### Bug Fixes

* Query condition depth bypass via pre-validation transform pipeline ([GHSA-9fjp-q3c4-6w3j](GHSA-9fjp-q3c4-6w3j)) ([#10257](#10257)) ([85994ef](85994ef))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 9.6.0-alpha.44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants