-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
refactor(query): deprecate explain without master key #7520
Conversation
Manages whether non-master users are allowed to use the "explain" parameter on queries Currently defaults to true, for backwards compatibility. However, this behaviour is deprecated, and at some point will default to false. Added tests for it
Codecov Report
@@ Coverage Diff @@
## master #7520 +/- ##
==========================================
- Coverage 93.92% 93.92% -0.01%
==========================================
Files 181 181
Lines 13273 13277 +4
==========================================
+ Hits 12467 12470 +3
- Misses 806 807 +1
Continue to review full report at Codecov.
|
Thanks for opening this PR! Apologies, I should have explained better; this should use the Runtime Deprecator without requiring the introduction of a new config option. It's actually a much smaller PR. |
You can just add a condition to where the query is executed and add a runtime deprecation. This is an example of how to use it, specifically the |
What are the advantages of having runtime deprecation vs having a config parameter? |
The main advantages is that otherwise, every deployment gets a deprecation warning on start up, even if they don't ever use explain. The other advantage is it's less code intrusive, so we don't have to add a temporary new config parameter, just to later remove it again. A config parameter needs to be validated, tested, documented, etc. There are cases where we may introduce a config parameter to deprecate something, for example if there is a complex change in code that we don't want to introduce all of a sudden, but phase-in to gather feedback and mature the change. In this case however, it's just a master key enforcement, which doesn't require phasing-in. |
Closing this PR in favor of #7521 |
New Pull Request Checklist
Issue Description
Currently, any user is able to run a query with the explain parameter and obtain the raw result returned by MongoDB. This discloses too much information to the clients, nor is it of great utility to them.
Related issue: #7519
Approach
rest.js now checks whether the user is allowed to use the
explain
option.The PR uses the depreactor to deprecate the current default, which is to allow even non-master users to use
explain
.TODOs before merging