Commit ec76bc9
committed
BUG#27361584: prevent invalid usage of globstars
Globstars ("**") can be used to create an implicit link between two
elements of a document path. They make it easier and less verbose to
perform operations on a deeper level of a document. However, they are
only valid in a specific setting where the both the leading and trailing
elements in the document path are correctly specified, like the
following:
'$.foo**.bar'
'$**.bar'
In practice, this means they cannot be used as the last item in a
document path.
The expression parser does not account for invalid usage of a globstar,
for instance, like in the following instances.
'$.foo.**bar'
'$.foo**'
'$**'
This patch addresses this issue and updates the sub-parser for
"documentPath" expressions to explicitely fail for the cases where a
globstar is the last item in such an expression.
Change-Id: If16c9e1d81af09e912026a566ecb4be173585c891 parent 174552b commit ec76bc9
File tree
3 files changed
+16
-13
lines changed- lib/ExprParser/lib/grammar/collectionOrTableExpressions
- test/unit/ExprParser
3 files changed
+16
-13
lines changedLines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
438 | | - | |
439 | | - | |
| 438 | + | |
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
328 | 327 | | |
329 | 328 | | |
330 | 329 | | |
331 | | - | |
332 | | - | |
| 330 | + | |
333 | 331 | | |
334 | 332 | | |
335 | 333 | | |
| |||
341 | 339 | | |
342 | 340 | | |
343 | 341 | | |
344 | | - | |
345 | | - | |
| 342 | + | |
346 | 343 | | |
347 | 344 | | |
348 | 345 | | |
349 | | - | |
350 | | - | |
| 346 | + | |
351 | 347 | | |
352 | 348 | | |
353 | | - | |
354 | | - | |
| 349 | + | |
355 | 350 | | |
356 | 351 | | |
357 | 352 | | |
| |||
0 commit comments