[SERVER-75623] Consider manually splitting by '.' and hashing field names for paths which can't be converted to FieldPath Created: 03/Apr/23 Updated: 29/Oct/23 Resolved: 29/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Will Buerger | Assignee: | Naafiyan Ahmed (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | QO 2023-06-26, QO 2023-07-10 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Some valid field names are considered invalid as a FieldPath (for example, fields like "foo.$bar" where a sub-component is prefixed with "$"). Currently, if serializeFieldPath errors due to supposedly "invalid" field names, we instead serialize that field name with a placeholder string. We should consider options to redact field names that are considered invalid to the FieldPath validation and remove any use of a placeholder string. The most obvious albeit non-optimal solution would be to manually split the string into its sub-components, then (as is done in serializeFieldPath) run the redaction policy over each component and reconstruct the redacted field. |
| Comments |
| Comment by Githook User [ 03/Jul/23 ] |
|
Author: {'name': 'Naafiyan Ahmed', 'email': 'naafiyan.ahmed@mongodb.com', 'username': 'naafiyan'}Message: |
| Comment by Githook User [ 29/Jun/23 ] |
|
Author: {'name': 'Naafiyan Ahmed', 'email': 'naafiyan.ahmed@mongodb.com', 'username': 'naafiyan'}Message: |
| Comment by Charlie Swanson [ 26/Apr/23 ] |
|
Ah I see, thanks! |
| Comment by Will Buerger [ 26/Apr/23 ] |
|
charlie.swanson@mongodb.com In the implementation of serializeFieldPathFromString, we rely on a try-catch of casting the string to a FieldPath. If it fails to cast to a FieldPath (e.g., if there's a sub-component of the field prefixed with $ like "foo.$bar"), we just serialize the string "dollarPlaceholder". This ticket is suggesting we actually manually parse the path "foo.$bar" and serialize its components in order to maintain the dotted path structure. |
| Comment by Charlie Swanson [ 26/Apr/23 ] |
|
will.buerger@mongodb.com I think we did something like this? If this is not done, could you clarify how it differs from this code? https://github.com/mongodb/mongo/blob/3c153350134076d8ea1fbc43f40feda55eec7c0a/src/mongo/db/query/serialization_options.h#L126 |