-
Notifications
You must be signed in to change notification settings - Fork 111
fix(readOnly): Do not allow $out and $merge in readOnly mode #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prevents MongoDB aggregation pipelines from using $out
and $merge
stages when the system is in read-only mode, ensuring data integrity by blocking operations that could write or modify data outside the current database.
- Adds validation to reject
$out
and$merge
stages in read-only mode - Introduces a new error code for forbidden write operations
- Includes comprehensive test coverage for both restricted stages
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/tools/mongodb/read/aggregate.ts | Adds stage validation logic to prevent write operations in read-only mode |
src/common/errors.ts | Introduces new error code for forbidden write operations |
tests/integration/tools/mongodb/read/aggregate.test.ts | Adds test cases to verify $out and $merge stages are blocked in read-only mode |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Looks good
Pull Request Test Coverage Report for Build 17494762061Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Proposed changes
MongoDB pipelines can generate new data and store it in another database, collection, S3 bucket and more using both the $merge and $out stages. We are disabling these stages in readOnly mode to avoid unexpected behaviour for the user.
Checklist