Skip to content

fix: LiveQuery ignores userField protectedFields groups and over-redacts fields the REST path returns - #10690

Merged
mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/livequery-userfield-protected-fields
Sep 24, 2026
Merged

mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/livequery-userfield-protected-fields

Conversation

@mtrezza

@mtrezza mtrezza commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Issue

LiveQuery never evaluates userField: groups in protectedFields, so it strips fields that the equivalent REST query returns to the same caller.

DatabaseController.filterSensitiveData resolves the class permissions with schema.getClassLevelPermissions(className) and falls back to {} when its schema argument does not expose that method. The LiveQuery server holds only the serialized class-level permissions from the published message and has no SchemaController for the class, so it passed the raw permissions object and the entire userField: block was skipped.

Because userField: groups intersect against the other groups, skipping them can only leave more fields protected. With protectedFields: { "*": ["ssn"], "userField:viewer": [] }, a REST get returns ssn to the user named by the viewer pointer, while the LiveQuery event for the same object strips it.

Approach

Wrap the class-level permissions in a minimal object exposing getClassLevelPermissions before handing them to filterSensitiveData, so the helper can reach them. This is the LiveQuery-side fix only; the other call site already passes a real SchemaController.

The sibling addProtectedFields call on the preceding line needs no wrapper, because that helper already falls back to treating its argument as the permissions object. That asymmetry between the two helpers is why the defect went unnoticed.

Tests cover both directions: the user named by the pointer now receives the field on the LiveQuery event exactly as over REST, and a user the pointer does not name still has it stripped.

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK

Summary by CodeRabbit

  • Bug Fixes
    • LiveQuery updates now apply protected-field access rules consistently with REST responses. Subscribers referenced by a protected-field permission can see the field, while other subscribers cannot; unprotected fields remain available in updates.

@parse-github-assistant

Copy link
Copy Markdown

🚀 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. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 8d44d2cd-3370-4139-bf0d-db143b655ce0

📥 Commits

Reviewing files that changed from the base of the PR and between bdb152e and a7dccae.

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

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

LiveQuery now passes class-level permissions through a schema adapter when filtering sensitive data. Added tests compare REST and LiveQuery access to protected fields for the referenced viewer and another user.

Changes

LiveQuery protected-field filtering

Layer / File(s) Summary
Adapt permissions and verify protected-field results
src/LiveQuery/ParseLiveQueryServer.ts, spec/ParseLiveQuery.spec.js
_filterSensitiveData passes a schema adapter to DatabaseController.filterSensitiveData. Tests check that REST and LiveQuery expose ssn to the referenced viewer, omit it for another user, and deliver the unprotected note field in LiveQuery updates.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a7dcc

The change aligns LiveQuery protected-field filtering with REST for the tested viewers. No actionable merge risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required fix: prefix, starts the summary with a capitalized word, and accurately describes the LiveQuery protected-fields fix.
Description check ✅ Passed The description includes the Issue, Approach, and Tasks sections. It clearly explains the defect, the implementation, and the test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed PASS. The only production change wraps trusted, serialized class-level permissions so DatabaseController.filterSensitiveData evaluates userField: groups. The existing helper compares pointer `obje…
Engage In Review Feedback ✅ Passed The supplied review result reports zero actionable findings for the current review. Therefore, this review contains no feedback that the user could have ignored or resolved without engagement. This as…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.83%. Comparing base (6bf4bd9) to head (a7dccae).
⚠️ Report is 1 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10690      +/-   ##
==========================================
- Coverage   93.84%   93.83%   -0.02%     
==========================================
  Files         192      192              
  Lines       16897    16898       +1     
  Branches      257      257              
==========================================
- Hits        15857    15856       -1     
- Misses       1018     1020       +2     
  Partials       22       22              

☔ View full report in Codecov by Harness.
📢 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 merged commit e8b3c92 into parse-community:alpha Sep 24, 2026
41 of 43 checks passed
@mtrezza
mtrezza deleted the fix/livequery-userfield-protected-fields branch September 24, 2026 03:11
parseplatformorg pushed a commit that referenced this pull request Sep 24, 2026
## [9.10.2-alpha.2](9.10.2-alpha.1...9.10.2-alpha.2) (2026-09-24)

### Bug Fixes

* LiveQuery ignores userField protectedFields groups and over-redacts fields the REST path returns ([#10690](#10690)) ([e8b3c92](e8b3c92))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.10.2-alpha.2

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