Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Rate Limit - safeRegexMatch does not match with Path #38473

Open
aydinnyunus opened this issue Feb 17, 2025 · 2 comments
Open

Global Rate Limit - safeRegexMatch does not match with Path #38473

aydinnyunus opened this issue Feb 17, 2025 · 2 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@aydinnyunus
Copy link

Title: Global Rate Limit - safeRegexMatch does not match with Path

Description:

safeRegexMatch does not match when query parameter is existing in the path.

Repro steps:

- properties:
            global:
              rate:
                - dimensions:
                    - headerValueMatch:
                        descriptorValue: test
                        headers:
                          - name: :path
                            safeRegexMatch:
                              regex: /test/([^/]+)/test
                    - requestHeaders:
                        descriptorKey: user-check
                        headerName: x-userid
                  requestPerUnit: 1
                  unit: minute
          type: ratelimit

I sent request with

curl http://test.service/test/123/test -H "x-userid: 1" it is matching.
curl "http://test.service/test/123/test?a=1" -H "x-userid: 1" does not match.

I think safeRegexMatch should match both of them because when I try on regex101 etc it was matched.

@aydinnyunus aydinnyunus added bug triage Issue requires triage labels Feb 17, 2025
@adisuissa adisuissa added question Questions that are neither investigations, bugs, nor enhancements and removed triage Issue requires triage bug labels Feb 18, 2025
@adisuissa
Copy link
Contributor

Thanks for raising this.
I think that no-partial matching in regex is by design (see

// The regex match string. The string must be supported by the configured engine. The regex is matched
// against the full string, not as a partial match.
string regex = 2 [(validate.rules).string = {min_len: 1}];
).

@aydinnyunus
Copy link
Author

Thank you for response but i did not understand then why it is not matched when query parameter is exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

2 participants