[SERVER-4558] namespace validation on insert uses substring matching not prefix matching Created: 26/Dec/11 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Aaron Staple | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | neweng, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
> c = db.coll.system.namespaces Presumably db.system.namespaces should be protected, but not db.coll.system.namespaces? I think there are some related validations that should be checked as well. |
| Comments |
| Comment by Steve Tarzia [ 15/Jul/22 ] | |||||||||||||||
|
Marking this as minor because the effect is just that users cannot use certain unusual collection names. | |||||||||||||||
| Comment by Matt Kangas [ 08/Jan/15 ] | |||||||||||||||
|
More detail from kevin.pulo@10gen.com, originally provided in There are places in the code where we do
or
to detect system namespaces. Such substring matching is incorrect, since it returns true for namespaces like "db.foo.system.bar", which are not usually considered system namespaces. Matching should be prefix-based, as is now done for writes, for example. This is along the same lines as SERVER-4558 and The cases that seem to be present currently are:
This ticket is to request that these occurrences in the code be updated to use prefix matches, not substring matches. Specifically:
Probably somewhere there should be single isSystemNamespace()/isSystemCollection() function(s) for doing this detection consistently. |