kong icon indicating copy to clipboard operation
kong copied to clipboard

fix(core): Regex header values in traditional router are now validated

Open StarlightIbuki opened this issue 1 year ago • 4 comments

Summary

ATT

Checklist

  • [x] The Pull Request has tests
  • [x] A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md

Issue reference

Fix FTI-5403

StarlightIbuki avatar Jan 18 '24 08:01 StarlightIbuki

what if someone want's a header to start with ~ but not to be treated as regex?

@nowNick It's not a problem for URL paths given every valid path begins with "/". Regex header inherits that design and we did not consider the issue. There is not a way to escape the "~", so something like "~1" can only be expressed with a trivial regex: "~~1".

StarlightIbuki avatar Feb 22 '24 04:02 StarlightIbuki

Does the path typedef have logic in common with this new typedef? Can we refactor to simplify and avoid duplication?

gszr avatar Feb 23 '24 14:02 gszr

@StarlightIbuki please review the comments above.

gszr avatar Feb 28 '24 16:02 gszr

Does the path typedef have logic in common with this new typedef? Can we refactor to simplify and avoid duplication?

Pathes have different requirements compared to headers. They need to start with slashes.

I've updated the PR to reuse the code as much as possible.

StarlightIbuki avatar Mar 14 '24 03:03 StarlightIbuki

Successfully created cherry-pick PR for master:

  • https://github.com/kong/kong-ee/pull/9512

team-gateway-bot avatar Jun 20 '24 07:06 team-gateway-bot

In my impression, the headers are using ~* as the prefix of regex patterns. Would this be a breaking change? I see KIC's tests against the nightly images are failing.

randmonkey avatar Jun 24 '24 03:06 randmonkey