Skip to content

fix: LiveQuery bypasses CLP pointer permission enforcement (GHSA-fph2-r4qg-9576)#10250

Merged
mtrezza merged 4 commits intoparse-community:alphafrom
mtrezza:fix/GHSA-fph2-r4qg-9576-v9
Mar 20, 2026
Merged

fix: LiveQuery bypasses CLP pointer permission enforcement (GHSA-fph2-r4qg-9576)#10250
mtrezza merged 4 commits intoparse-community:alphafrom
mtrezza:fix/GHSA-fph2-r4qg-9576-v9

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 20, 2026

Issue

LiveQuery bypasses CLP pointer permission enforcement (GHSA-fph2-r4qg-9576)

Tasks

  • Add tests
  • Add changes

@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

Implements pointer-based CLP checks in LiveQuery delivery: ParseLiveQueryServer now evaluates class-level pointer permissions (readUserFields/writeUserFields and pointerFields) and can block event delivery when the subscribing user is not referenced; tests validating multiple pointer/CLP scenarios were added.

Changes

Cohort / File(s) Summary
LiveQuery CLP Pointer Enforcement
src/LiveQuery/ParseLiveQueryServer.ts
Capture _matchesCLP return in _onAfterSave/_onAfterDelete and early-return on false. _matchesCLP now resolves session-token userId into a reusable variable, merges pointerFields with permission-specific pointer relations (readUserFields/writeUserFields), and when not using master key ensures at least one pointer on the object references the subscriber. Supports pointer values via .get(), plain field access, .id, .objectId, and arrays.
LiveQuery CLP Pointer Enforcement Tests
spec/vulnerabilities.spec.js
Add GHSA-fph2-r4qg-9576 test suite (multiple tests) that update class CLP via master-key PUT /schemas/<class>, reconfigure LiveQuery per test, create authenticated/unauthenticated subscriptions, perform master-key writes, and assert whether create/enter events are delivered or withheld across pointer/CLP permutations.

Sequence Diagram

sequenceDiagram
    participant Client as Client / Subscriber
    participant LQ as LiveQuery Server
    participant SC as SchemaController
    participant DB as Database

    Client->>LQ: Subscribe (with/without session token)
    DB->>LQ: Emit create/update/delete event (write occurred)
    LQ->>SC: Fetch schema & CLP for class
    SC-->>LQ: Return schema & CLP
    alt CLP includes pointer restrictions
        LQ->>LQ: Resolve subscriber userId from token (if present)
        LQ->>LQ: Determine permissionField (readUserFields/writeUserFields)
        LQ->>LQ: Merge pointerFields from CLP and permission arrays
        LQ->>LQ: Inspect object pointer values (.get / field / .id / .objectId / arrays)
        alt master key OR pointer references subscriber
            LQ->>Client: Deliver event
        else
            LQ-->>LQ: Withhold event (do not deliver)
        end
    else
        LQ->>Client: Deliver event
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author, failing to include required sections from the template such as Issue, Approach, and Tasks. Add a description following the repository template: include the related Issue/GHSA link, describe the Approach (pointer-field enforcement in LiveQuery CLP matching), and check relevant Tasks (tests and security checks are implemented).
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing a LiveQuery CLP pointer permission enforcement bypass (GHSA-fph2-r4qg-9576), which aligns with the core security fix in the changeset.

✏️ 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.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.13%. Comparing base (98f4ba5) to head (b1df213).
⚠️ Report is 3 commits behind head on alpha.

Files with missing lines Patch % Lines
src/LiveQuery/ParseLiveQueryServer.ts 69.23% 10 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10250      +/-   ##
==========================================
- Coverage   92.60%   92.13%   -0.48%     
==========================================
  Files         192      192              
  Lines       16358    16394      +36     
  Branches      201      219      +18     
==========================================
- Hits        15149    15105      -44     
- Misses       1192     1266      +74     
- Partials       17       23       +6     

☔ 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.

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

🧹 Nitpick comments (1)
spec/vulnerabilities.spec.js (1)

3353-3637: Reset the default LiveQuery client around this suite.

These tests reconfigure the LiveQuery server on every case but keep using the Parse SDK singleton client. Other LiveQuery suites in this file clear it in beforeEach and close it in afterEach; without that, socket/subscription state can leak across cases and make the suite order-dependent.

Suggested cleanup pattern
 describe('(GHSA-fph2-r4qg-9576) LiveQuery bypasses CLP pointer permission enforcement', () => {
   const { sleep } = require('../lib/TestUtils');
+
+  beforeEach(() => {
+    Parse.CoreManager.getLiveQueryController().setDefaultLiveQueryClient(null);
+  });
+
+  afterEach(async () => {
+    const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient();
+    if (client) {
+      await client.close();
+    }
+  });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spec/vulnerabilities.spec.js` around lines 3353 - 3637, Add setup/teardown to
this describe('(GHSA-fph2-r4qg-9576) LiveQuery bypasses CLP pointer permission
enforcement', ...) block that mirrors other LiveQuery suites: in a beforeEach
call, reset/clear the Parse SDK's default LiveQuery client (close any existing
socket/subscriptions) and in an afterEach call, close and null out the singleton
so subsequent tests get a fresh client; use the standard beforeEach/afterEach
hooks and the same methods used elsewhere to close the default LiveQuery client
and clear the singleton to prevent socket/subscription state leaking across
cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/LiveQuery/ParseLiveQueryServer.ts`:
- Around line 676-739: The current pointer-CLP check in ParseLiveQueryServer
(inside the block that uses SchemaController.testPermissions and pointerFields)
actively throws Parse.Error.OPERATION_FORBIDDEN for object-specific denials,
which breaks live-query transitions; instead treat pointer CLPs as visibility
filters: convert this check (and similar checks) to return a boolean match
(e.g., via a helper like _matchesCLP) that quietly returns false when the
current user should not see the object rather than throwing; update callers such
as _onAfterSave/_onUpdate/_onCreate to skip emitting events when _matchesCLP
returns false, keep master-key bypass (client.hasMasterKey) as-is, and remove
the throw-paths that raise OPERATION_FORBIDDEN for pointer-based denials so
ACL-like misses are silently ignored.

---

Nitpick comments:
In `@spec/vulnerabilities.spec.js`:
- Around line 3353-3637: Add setup/teardown to this
describe('(GHSA-fph2-r4qg-9576) LiveQuery bypasses CLP pointer permission
enforcement', ...) block that mirrors other LiveQuery suites: in a beforeEach
call, reset/clear the Parse SDK's default LiveQuery client (close any existing
socket/subscriptions) and in an afterEach call, close and null out the singleton
so subsequent tests get a fresh client; use the standard beforeEach/afterEach
hooks and the same methods used elsewhere to close the default LiveQuery client
and clear the singleton to prevent socket/subscription state leaking across
cases.
🪄 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: 24d45539-a0d2-4dec-a368-0933fa255068

📥 Commits

Reviewing files that changed from the base of the PR and between b50e14e and ac3c6c4.

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

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 3353-3358: Add an afterEach that cleans up the LiveQuery client:
retrieve the client via
Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient(), and if
it exists await its close() method and then call
Parse.CoreManager.getLiveQueryController().setDefaultLiveQueryClient(null);
ensure the afterEach is async so the await works and prevent connection leaks
between tests.
🪄 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: bc20c177-3429-456e-9d13-af69aed07003

📥 Commits

Reviewing files that changed from the base of the PR and between ac3c6c4 and 04be4b0.

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 20, 2026
@mtrezza mtrezza changed the title fix: GHSA-fph2-r4qg-9576 v9 fix: LiveQuery bypasses CLP pointer permission enforcement (GHSA-fph2-r4qg-9576) Mar 20, 2026
@mtrezza mtrezza merged commit 6c3317a into parse-community:alpha Mar 20, 2026
20 of 24 checks passed
parseplatformorg pushed a commit that referenced this pull request Mar 20, 2026
# [9.6.0-alpha.42](9.6.0-alpha.41...9.6.0-alpha.42) (2026-03-20)

### Bug Fixes

* LiveQuery bypasses CLP pointer permission enforcement ([GHSA-fph2-r4qg-9576](https://github.com/parse-community/parse-server/security/advisories/GHSA-fph2-r4qg-9576)) ([#10250](#10250)) ([6c3317a](6c3317a))
@parseplatformorg
Copy link
Contributor

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

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Mar 20, 2026
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