fix: LiveQuery ignores userField protectedFields groups and over-redacts fields the REST path returns - #10690
Conversation
…cts fields the REST path returns
|
🚀 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
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. |
|
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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLiveQuery 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. ChangesLiveQuery protected-field filtering
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
## [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))
|
🎉 This change has been released in version 9.10.2-alpha.2 |
Issue
LiveQuery never evaluates
userField:groups inprotectedFields, so it strips fields that the equivalent REST query returns to the same caller.DatabaseController.filterSensitiveDataresolves the class permissions withschema.getClassLevelPermissions(className)and falls back to{}when itsschemaargument does not expose that method. The LiveQuery server holds only the serialized class-level permissions from the published message and has noSchemaControllerfor the class, so it passed the raw permissions object and the entireuserField:block was skipped.Because
userField:groups intersect against the other groups, skipping them can only leave more fields protected. WithprotectedFields: { "*": ["ssn"], "userField:viewer": [] }, a RESTgetreturnsssnto the user named by theviewerpointer, while the LiveQuery event for the same object strips it.Approach
Wrap the class-level permissions in a minimal object exposing
getClassLevelPermissionsbefore handing them tofilterSensitiveData, so the helper can reach them. This is the LiveQuery-side fix only; the other call site already passes a realSchemaController.The sibling
addProtectedFieldscall 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
Summary by CodeRabbit