fix: Default ACL overwrites custom ACL on Parse.Object update#10061
fix: Default ACL overwrites custom ACL on Parse.Object update#10061mtrezza merged 8 commits intoparse-community:alphafrom
Parse.Object update#10061Conversation
The test "should not overwrite ACL with defaultACL on update" was failing
with "Permission denied" (code 119) because the CLP configuration was
missing the addField permission. When the test called obj.set('field',
'value'), it attempted to add a new field to the class, which requires
addField CLP permission. Without it, addField defaults to {} (no access),
causing the operation to be rejected.
|
🚀 Thanks for opening this pull request! |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughDefault ACLs are now applied only for create operations (no query present), not on updates. Two tests were added to ensure updates do not overwrite existing ACLs and that explicit ACL changes on update are respected. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai what's the difference between this PR and #10003 where the CI failed? Analyze the diff and whether the fix is valid. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 10023
Identical Code Changes ✓Both PRs make the exact same fix to Critical Test DifferencePR await schema.updateClass('TestObject', {}, {
create: { '*': true },
update: { '*': true },
// Missing addField permission!
ACL: { ... }
});PR await schema.updateClass('TestObject', {}, {
create: { '*': true },
update: { '*': true },
addField: { '*': true }, // ← Added
ACL: { ... }
});Why This MattersIn the first test, the line
Validation ✅The fix in this PR is valid because:
The CI failures in PR 🧠 Learnings used |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10061 +/- ##
==========================================
- Coverage 92.59% 92.57% -0.02%
==========================================
Files 191 191
Lines 15603 15603
Branches 176 176
==========================================
- Hits 14447 14445 -2
- Misses 1144 1146 +2
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Parse.Object update
|
@coderabbitai check this change for potential security issues, since we're dealing with ACL here. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 5047 🏁 Script executed: Length of output: 1328 🏁 Script executed: Length of output: 5061 🏁 Script executed: Length of output: 8476 🏁 Script executed: Length of output: 896
Security Analysis: ✅ No vulnerabilities introducedWhat ChangedThe fix adds Security Protections Still In Place
Why This Change Is SecureBefore (buggy behavior): // Object has ACL: {user123: {read: true, write: true}}
obj.set('field', 'value');
obj.save(); // Default ACL would OVERWRITE the existing ACL ❌After (fixed behavior): // Object has ACL: {user123: {read: true, write: true}}
obj.set('field', 'value');
obj.save(); // Existing ACL is PRESERVED ✅Edge Case AnalysisQ: What if an object exists without an ACL and gets updated? This could happen for:
A: Not a security issue because:
ConclusionThe fix is security-sound and actually improves security posture by:
No action required from a security perspective. The code change correctly implements the intended behavior while maintaining Parse Server's layered security model. 🧠 Learnings used |
# [9.3.0-alpha.6](9.3.0-alpha.5...9.3.0-alpha.6) (2026-02-14) ### Bug Fixes * Default ACL overwrites custom ACL on `Parse.Object` update ([#10061](#10061)) ([4ef89d9](4ef89d9))
|
🎉 This change has been released in version 9.3.0-alpha.6 |
Summary
Parse.Objectupdate #10003 by adding the missingaddField: { '*': true }CLP to the test setup"should not overwrite ACL with defaultACL on update"was failing withPermission denied(code 119) becauseobj.set('field', 'value')adds a new field to the class, which requiresaddFieldCLP permissionaddFieldin the CLP config, it defaults to{}(no access), causing the operation to be rejected before the ACL update logic is even reachedCloses #10003
Context
This PR includes the fix from #10003 (adding
!this.queryguard to prevent default ACL from overwriting custom ACL on update) along with the test fix. The original PR's code change insrc/RestWrite.jsis correct — only the test needed adjustment.Test plan
should not overwrite ACL with defaultACL on update— now passesshould allow explicit ACL modification on update— still passessupport defaultACL in schema— still passesSummary by CodeRabbit
Bug Fixes
Tests