test: Add _Installation non-master access control regression tests#10578
Conversation
|
🚀 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. |
📝 WalkthroughWalkthroughAdded four tests verifying forbidden installation queries and deletions for unauthenticated and authenticated non-master clients, including confirmation that rejected deletions preserve the installation record. ChangesInstallation access control
Estimated code review effort: 2 (Simple) | ~10 minutes Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (6 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
spec/ParseInstallation.spec.js (1)
1301-1375: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCoverage gap: no test for authenticated non-master delete.
The suite covers unauthenticated find, unauthenticated delete, and authenticated non-master find — but not authenticated non-master delete. Given the PR's goal is comprehensive non-master installation access-control regression coverage, consider adding a fourth test mirroring "blocks the find operation for an authenticated non-master user" but for the delete endpoint, following the same row-preservation check used in the unauthenticated delete test.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@spec/ParseInstallation.spec.js` around lines 1301 - 1375, Add a test in the access-control describe block covering DELETE on _Installation for an authenticated non-master user, mirroring the setup and session-token headers from “blocks the find operation for an authenticated non-master user.” Assert the request returns OPERATION_FORBIDDEN with “Permission denied,” then verify via a master-key query that the installation row remains present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@spec/ParseInstallation.spec.js`:
- Around line 1307-1325: Update the three rejection tests around the request
try/catch blocks so each fail('... should have been rejected') immediately
returns (or throws), preventing execution from dereferencing an undefined error
when the request unexpectedly succeeds.
---
Nitpick comments:
In `@spec/ParseInstallation.spec.js`:
- Around line 1301-1375: Add a test in the access-control describe block
covering DELETE on _Installation for an authenticated non-master user, mirroring
the setup and session-token headers from “blocks the find operation for an
authenticated non-master user.” Assert the request returns OPERATION_FORBIDDEN
with “Permission denied,” then verify via a master-key query that the
installation row remains present.
🪄 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: ea810e75-461c-4062-8d6e-5cd4ec24dbad
📒 Files selected for processing (1)
spec/ParseInstallation.spec.js
|
@coderabbitai review |
✅ Action performedReview finished.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10578 +/- ##
==========================================
+ Coverage 92.68% 92.69% +0.01%
==========================================
Files 193 193
Lines 17025 17025
Branches 248 248
==========================================
+ Hits 15779 15781 +2
+ Misses 1225 1223 -2
Partials 21 21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
🎉 This change has been released in version 9.10.1-alpha.2 |
Issue
The
_Installationaccess-control contract for non-master clients was only partially covered by tests.enforceRoleSecurity(src/SharedRest.js) blocks thefindanddeleteoperations on_Installationfor non-master/non-maintenance callers, while intentionally allowingcreate,update, andgetto fall through (push registration happens before a user logs in). There was no explicit regression coverage for thedeleteblock, nor for the fact thatfindis blocked for authenticated non-master users, not just anonymous ones.Approach
Add a
describe('access control for non-master clients')block inspec/ParseInstallation.spec.jsthat locks in the contract:findis rejected for an unauthenticated client and for an authenticated non-master user, so installations cannot be enumerated and a row's identifier cannot be discovered.deleteis rejected for an unauthenticated client and for an authenticated non-master user, and the row is verified to survive via an exact adapterfind(which avoids Postgres estimated-count behavior).The by-design
get/updateof one's own installation remains covered by the existing#1718and#2090tests referenced in the block.Tasks