fix: Cloud Hooks and Cloud Jobs bypass readOnlyMasterKey write restriction (GHSA-vc89-5g3r-cmhh)#10089
Conversation
|
I will reformat the title to use the proper commit message syntax. |
|
🚀 Thanks for opening this pull request! |
📝 WalkthroughWalkthroughIntroduces read-only masterKey permission validation to prevent hook creation/modification and job execution. Guard clauses in HooksRouter and FunctionsRouter check Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
✅ 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. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
spec/rest.spec.js (1)
1176-1307: Consider extracting a small request helper for repeated read-only headers/payload setup.This block has repeated request construction; a helper would reduce duplication and make future endpoint additions easier.
♻️ Optional refactor sketch
+ const readOnlyHeaders = { + 'X-Parse-Application-Id': Parse.applicationId, + 'X-Parse-Master-Key': 'read-only-test', + 'Content-Type': 'application/json', + }; + + async function expectReadOnlyForbidden({ url, method, body }) { + try { + await request({ url, method, headers: readOnlyHeaders, body }); + fail('should have thrown'); + } catch (res) { + expect(res.data.code).toBe(Parse.Error.OPERATION_FORBIDDEN); + expect(res.data.error).toBe('Permission denied'); + } + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@spec/rest.spec.js` around lines 1176 - 1307, The tests repeat identical request construction with the same read-only master key headers and JSON body setup (multiple calls to request({...}) for endpoints like '/hooks/functions', '/hooks/triggers', '/jobs/readOnlyTestJob'), so extract a small helper (e.g., requestWithReadOnlyMasterKey or makeReadOnlyRequest) that wraps request and injects 'X-Parse-Application-Id', 'X-Parse-Master-Key': 'read-only-test', and 'Content-Type': 'application/json' plus optional method, url, and body; update the tests (the it blocks that call request({...})) to call this helper to remove duplication and centralize header/body defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@spec/rest.spec.js`:
- Around line 1176-1307: The tests repeat identical request construction with
the same read-only master key headers and JSON body setup (multiple calls to
request({...}) for endpoints like '/hooks/functions', '/hooks/triggers',
'/jobs/readOnlyTestJob'), so extract a small helper (e.g.,
requestWithReadOnlyMasterKey or makeReadOnlyRequest) that wraps request and
injects 'X-Parse-Application-Id', 'X-Parse-Master-Key': 'read-only-test', and
'Content-Type': 'application/json' plus optional method, url, and body; update
the tests (the it blocks that call request({...})) to call this helper to remove
duplication and centralize header/body defaults.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-8.x.x #10089 +/- ##
=================================================
- Coverage 92.61% 92.59% -0.02%
=================================================
Files 191 191
Lines 15509 15517 +8
Branches 177 177
=================================================
+ Hits 14363 14368 +5
- Misses 1134 1137 +3
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
readOnlyMasterKey write restriction (GHSA-vc89-5g3r-cmhh)
## [8.6.4](8.6.3...8.6.4) (2026-03-04) ### Bug Fixes * Cloud Hooks and Cloud Jobs bypass `readOnlyMasterKey` write restriction (GHSA-vc89-5g3r-cmhh) ([#10089](#10089)) ([6c79da9](6c79da9))
|
🎉 This change has been released in version 8.6.4 |
Pull Request
Issue
Cloud Hooks and Cloud Jobs bypass
readOnlyMasterKeywrite restriction (GHSA-vc89-5g3r-cmhh).Tasks
Summary by CodeRabbit
New Features
Tests