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

Regression: CORS.match_origin regex #6630

Open
LongLiveCHIEF opened this issue Jan 23, 2025 · 0 comments
Open

Regression: CORS.match_origin regex #6630

LongLiveCHIEF opened this issue Jan 23, 2025 · 0 comments

Comments

@LongLiveCHIEF
Copy link

Describe the bug

when configuring the CORS.match_origins in router 1.57, the following was valid regex for the configuration:

match_origins:
  - ^https:\/\/*[.]example[.]com$
  - ^https:\/\/*[.]example[.]org$
  - ^https:\/\/*[.]i?t1.example$
  - ^https:\/\/([a-z0-9-][.])*(?!test)([a-z])?[.]example[.]com$
  - ^https:\/\/([a-z0-9-][.])*([a-z])?[.]example[.]com$

Today I tested deployment of 2.0.0-preview.4 using existing configuration, and received the following error due to this CORS.match_origin configuration:

{"timestamp":"2025-01-20T15:27:49.439586773Z","level":"ERROR","message":"could not create router: CORS configuration error: match origin regex '^https:\\/
/([a-z0-9-][.])*(?!test)([a-z])?[.]example[.]com$' is not valid: regex parse error:
^https:\\/\\/([a-z0-9-][.])*(?!test)([a-z])?[.]preview[.]com$
                             ^^^\nerror: look-around, including look-ahead and look-behind, is not supported","target":"apollo_router::executable","resource":{"service.name":"graph@variant","service.version":"2.0.0-preview.4","process.executable.name":"router"}}
could not create router: CORS configuration error: match origin regex '^https:\/\/([a-z0-9-][.])*(?!test)([a-z])?[.]example[.]com$' is not valid: regex parse error:
^https:\/\/([a-z0-9-][.])*(?!test)([a-z])?[.]example[.]com$
^^^
error: look-around, including look-ahead and look-behind, is not supported

To Reproduce

use a lookaround/lookahead/lookbehind in a CORS.match_origin router config

Expected behavior

This used to be a valid regex string, but preview versions don't allow it.

Output

If applicable, add output to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context

I was able to take out the erroring part and just create another regex with the strict match to satisfy my conditions, but I wanted to make sure the issue is open in case it exposes an uncovered/needed test case in the testing pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant