Skip to content

fix: Protected field change detection oracle via LiveQuery watch parameter (GHSA-qpc3-fg4j-8hgm)#10253

Merged
mtrezza merged 2 commits intoparse-community:alphafrom
mtrezza:fix/GHSA-qpc3-fg4j-8hgm-v9
Mar 20, 2026
Merged

fix: Protected field change detection oracle via LiveQuery watch parameter (GHSA-qpc3-fg4j-8hgm)#10253
mtrezza merged 2 commits intoparse-community:alphafrom
mtrezza:fix/GHSA-qpc3-fg4j-8hgm-v9

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 20, 2026

Issue

Protected field change detection oracle via LiveQuery watch parameter (GHSA-qpc3-fg4j-8hgm)

@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

parseplatformorg commented Mar 20, 2026

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 PR enforces protected-field authorization for LiveQuery subscriptions by validating request.query.watch entries during subscribe-time. Subscriptions that attempt to watch protected fields (including dot-notation and nested paths) are rejected with Parse.Error.OPERATION_FORBIDDEN for non-master-key clients. Tests exercising these cases and allowed behaviors were added.

Changes

Cohort / File(s) Summary
LiveQuery server validation
src/LiveQuery/ParseLiveQueryServer.ts
Added subscribe-time checks to _handleSubscribe to validate request.query.watch entries against class protectedFields; rejects subscriptions targeting protected fields (including root matches and dot-notated nested paths) with Parse.Error.OPERATION_FORBIDDEN when no master key is present.
LiveQuery protected-field tests
spec/vulnerabilities.spec.js
Added LiveQuery test suite configuring SecretClass with protectedFields: { '*': ['secretObj'] }. Tests assert subscription rejection when watching secretObj, secretObj.apiKey, and secretObj.nested.deep.key; assert successful watch on publicField and that delivered update events omit protected data and do not emit updates for changes confined to unwatched protected fields.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client as Client
participant LQ as LiveQuery Server
participant PS as Parse Server / Auth
participant DB as Database
Client->>LQ: subscribe(request:{where, watch})
LQ->>PS: validate request & check masterKey
PS-->>LQ: auth result (masterKey? / protectedFields)
alt watch contains protected field AND not masterKey
LQ-->>Client: error Parse.Error.OPERATION_FORBIDDEN ("Permission denied")
else allowed
LQ-->>Client: subscription acknowledged
DB-->>LQ: data change event
LQ->>LQ: filter out protected fields from payload
LQ-->>Client: update (with protected fields omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty; no description was provided by the author, leaving required sections like Issue and Approach entirely unfilled. Add a complete pull request description including the Issue section (referencing GHSA-qpc3-fg4j-8hgm), the Approach section explaining the protected field validation changes, and checked-off tasks.
✅ 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 clearly describes the main change: fixing a protected field change detection vulnerability via LiveQuery watch parameter enforcement, with specific CVE reference.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@spec/vulnerabilities.spec.js`:
- Around line 3739-3750: The test "should not deliver update event when only
non-watched public field changes" is inconsistent: it watches 'publicField' via
query.watch('publicField') but then calls obj.set('publicField', 'visible')
which is a no-op on the watched field; change the test body to modify a truly
non-watched field (e.g., obj.set('nonWatchedField', 'value') or a protected
field) or alternatively rename the test to reflect that it's doing a no-op
update on a watched field; update references to subscription and updateSpy
accordingly so the assertion expect(updateSpy).not.toHaveBeenCalled() matches
the corrected scenario.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b88d7f70-33f0-4b7b-9cea-90267c85bfb3

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa7543 and 41bdd45.

📒 Files selected for processing (2)
  • spec/vulnerabilities.spec.js
  • src/LiveQuery/ParseLiveQueryServer.ts

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.54%. Comparing base (6c3317a) to head (99aba0f).
⚠️ Report is 3 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10253   +/-   ##
=======================================
  Coverage   92.53%   92.54%           
=======================================
  Files         192      192           
  Lines       16394    16399    +5     
  Branches      219      221    +2     
=======================================
+ Hits        15171    15177    +6     
+ Misses       1204     1203    -1     
  Partials       19       19           

☔ 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-qpc3-fg4j-8hgm v9 fix: Protected field change detection oracle via LiveQuery watch parameter (GHSA-qpc3-fg4j-8hgm) Mar 20, 2026
@mtrezza mtrezza merged commit 0c0a0a5 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.43](9.6.0-alpha.42...9.6.0-alpha.43) (2026-03-20)

### Bug Fixes

* Protected field change detection oracle via LiveQuery watch parameter ([GHSA-qpc3-fg4j-8hgm](GHSA-qpc3-fg4j-8hgm)) ([#10253](#10253)) ([0c0a0a5](0c0a0a5))
@parseplatformorg
Copy link
Contributor

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

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