[SERVER-36962] ViewCatalog::resolveView() may return invalid resolved view on encountering invalid namespace in view definition Created: 31/Aug/18 Updated: 27/Oct/23 Resolved: 27/Sep/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | James Wahlin | Assignee: | Haley Connelly |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | query-44-grooming, read-only-views | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Operating System: | ALL |
| Steps To Reproduce: | Discovered via code inspection. Not sure if this can be reproduced externally. |
| Sprint: | Execution Team 2019-10-07 |
| Participants: |
| Description |
|
The ViewCatalog::_lookup_inlock() method will return a null shared_ptr if either:
ViewCatalog::resolveView() however interprets the null shared_ptr as an indication that the namespace is a collection and returns the resolved view. This is incorrect in the case that ViewCatalog::_lookup_inlock() returns due to invalid collection name |
| Comments |
| Comment by Haley Connelly [ 27/Sep/19 ] |
|
The current version of ViewCatalog::resolveView() calls _lookup(), which no longer checks to see if the namespace is a valid collection name. Due to changes in the code, and since we still allow for views to be created on nonexistent collection namespaces, we believe this is no longer an issue and are closing the ticket. |
| Comment by Kyle Suarez [ 04/Sep/18 ] |
|
James and I had an in-person conversation about this and threw around a few ideas:
Since we haven't seen this code result in an actual bug for users or in our CI system, I would say it's best to not spend too much time on this if at all. |
| Comment by Kyle Suarez [ 04/Sep/18 ] |
|
james.wahlin, I believe that view resolution only happens as part of user commands (that is, I don't think ViewCatalog::resolveView() is ever called during the server startup path). Do you think it would be sufficient for ViewCatalog::_lookup_inlock() to throw if the namespace is invalid and the OperationContext indicates that the request comes from a user connection? |
| Comment by James Wahlin [ 31/Aug/18 ] |
|
As part of this we should audit other callers of ViewCatalog::_lookup_inlock() for potential issues. |