Skip to content

uri_template: Add support for the "*" character matching in pattern rewrite and matching #39169

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

Merged
merged 7 commits into from
May 2, 2025

Conversation

barchw
Copy link
Contributor

@barchw barchw commented Apr 18, 2025

Commit Message: uri_template: Add support for the "*" character matching in pattern rewrite and matching
Additional Description:
Adds support for matching requests that include the * character in the path. A relevant issue was created: #39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: #39168

Copy link

Hi @barchw, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #39169 was opened by barchw.

see: more, trace.

@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch 2 times, most recently from f4ae9e2 to f453fe9 Compare April 18, 2025 14:12
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from 5cfc62e to bf77bcd Compare April 18, 2025 15:03
"="; // user included "=" allowed
"=*"; // restricted characters
Copy link
Member

@mathetake mathetake Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @RyanTheOptimist as a reviewer of this exclusion of * reserved character. do you have any context why it's the only char excluded?

Using the literal * in a path seems really a bad practice to me however (e.g. google search doesn't support non encoded reserved chars, not limited to *), so i am not sure if we want to expand this direction.

Copy link
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/wait-any

@@ -44,7 +44,7 @@ constexpr absl::string_view kLiteral = "a-zA-Z0-9-._~" // Unreserved
"%" // pct-encoded
"!$&'()+,;" // sub-delims excluding *=
":@"
"="; // user included "=" allowed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know why * was excluded as a match character. But for a change like this a runtime guard is required as a minimum, since it changes the existing behavior of the matcher.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yanavlasov, thanks for looking into this, I have moved the feature behind a runtime guard.

Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #39169 was synchronize by barchw.

see: more, trace.

barchw added 3 commits April 22, 2025 13:42
…ewrite and matching

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Chwila <bartosz.chwila@sap.com>
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from 412071e to 8998e86 Compare April 22, 2025 11:44
Signed-off-by: Chwila <bartosz.chwila@sap.com>
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch 2 times, most recently from afee755 to 45fa9bc Compare April 22, 2025 12:45
Signed-off-by: Chwila <bartosz.chwila@sap.com>
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from 45fa9bc to e3e313e Compare April 22, 2025 13:11
Signed-off-by: Chwila <bartosz.chwila@sap.com>
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from 870e754 to f6dd87f Compare April 22, 2025 13:58
Copy link
Contributor

@RyanTheOptimist RyanTheOptimist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo a small nit

@@ -46,6 +47,14 @@ constexpr absl::string_view kLiteral = "a-zA-Z0-9-._~" // Unreserved
":@"
"="; // user included "=" allowed

// Additional literal that allows "*" in the pattern.
// Valid pchar from https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
constexpr absl::string_view kLiteralAsterisk = "a-zA-Z0-9-._~" // Unreserved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should probably be "LiteralWithAsterisk". The current name makes it sound like it would be just a literal asterisk. (And perhaps add a comment about removing when we remove the runtime feature)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, adapted

@barchw barchw requested a review from RyanTheOptimist April 30, 2025 19:24
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from 26f07e8 to f4900c0 Compare April 30, 2025 19:32
Signed-off-by: Chwila <bartosz.chwila@sap.com>
@barchw barchw force-pushed the fix-uri-template-asterisk-sign branch from f4900c0 to 9716900 Compare April 30, 2025 19:54
@yanavlasov yanavlasov merged commit 59c6863 into envoyproxy:main May 2, 2025
24 checks passed
@phlax
Copy link
Member

phlax commented May 5, 2025

/backport

@repokitteh-read-only repokitteh-read-only bot added the backport/review Request to backport to stable releases label May 5, 2025
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
yanavlasov pushed a commit to yanavlasov/envoy that referenced this pull request May 5, 2025
…ewrite and matching (envoyproxy#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
envoyproxy#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: envoyproxy#39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
phlax pushed a commit that referenced this pull request May 5, 2025
…ewrite and matching (#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: #39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
phlax pushed a commit that referenced this pull request May 5, 2025
…ewrite and matching (#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: #39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
phlax pushed a commit that referenced this pull request May 6, 2025
…ewrite and matching (#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: #39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
phlax pushed a commit that referenced this pull request May 6, 2025
…ewrite and matching (#39169)

Adds support for matching requests that include the `*` character in the
path. A relevant issue was created:
#39168
Risk Level:
Testing: Updated unit tests
Docs Changes: N/A
Release Notes: Added
Platform Specific Features: N/A
Runtime guard: envoy.reloadable_features.uri_template_match_on_asterisk

Resolves: #39168

---------

Signed-off-by: Chwila <bartosz.chwila@sap.com>
Signed-off-by: Yan Avlasov <yavlasov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/review Request to backport to stable releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URI template operators * and ** do not match the * character
5 participants