Commit 19822fb
committed
fix: reject {expr}{+var} adjacency to close ReDoS gap
The adjacency check rejected {+a}{b} but not the symmetric {a}{+b}.
Both produce overlapping greedy quantifiers; a 64KB crafted input
against prefix{a}{+b}.json takes ~23s to reject.
Added prev_path_expr tracking so {+var} immediately after any path
expression is rejected. {expr}{#var} remains allowed since the #
operator prepends a literal '#' that the preceding group's character
class excludes, giving a natural boundary.
Also adds the missing 'from typing import Any' to the three low-level
server examples in docs/server/resources.md.1 parent c8712ff commit 19822fb
3 files changed
+23
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| |||
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
| 314 | + | |
| 315 | + | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| |||
373 | 377 | | |
374 | 378 | | |
375 | 379 | | |
| 380 | + | |
| 381 | + | |
376 | 382 | | |
377 | 383 | | |
378 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | | - | |
823 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
824 | 827 | | |
825 | 828 | | |
826 | 829 | | |
| |||
836 | 839 | | |
837 | 840 | | |
838 | 841 | | |
| 842 | + | |
839 | 843 | | |
840 | 844 | | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
844 | 848 | | |
845 | 849 | | |
| 850 | + | |
846 | 851 | | |
847 | 852 | | |
848 | 853 | | |
849 | 854 | | |
850 | 855 | | |
851 | 856 | | |
852 | 857 | | |
| 858 | + | |
853 | 859 | | |
854 | 860 | | |
855 | | - | |
| 861 | + | |
856 | 862 | | |
857 | | - | |
| 863 | + | |
858 | 864 | | |
859 | 865 | | |
860 | 866 | | |
| |||
872 | 878 | | |
873 | 879 | | |
874 | 880 | | |
| 881 | + | |
875 | 882 | | |
876 | 883 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
| |||
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
202 | | - | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
| |||
0 commit comments