stefanprodan / AspNetCoreRateLimit

ASP.NET Core rate limiting middleware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Documentation of regex path matching behavior

mcshaz opened this issue · comments

The behavior of the regexes is standard regex behavior matching for any part of the string, but this makes it very different to the wildcard behavior.

If leaving in the current form, I think it should be documented with a table like below with the wildcard equivalent behavior. Alternatively the regexes could have a $ appended unless already present in the regex. :/bar/* would be unnecessarily converted to :/bar/*$ , but of course this will still work.

If staying with the current form, I would advocate the appsettings.regex.json file should be changed to manually add a $ at the end in order to decrease fragility of the tests as the base tests expands.

Whitelist Value Path Regex Behavior Wildcard Behavior
:foo get:/foo match match
:foo get:/foo2 match X
:foo get:/foo/bar/baz match X
:/ get:/[any_path] match X
:/ get:/ match match