Skip to content

Commit 5b08a31

Browse files
authored
Add docs and examples for path templating (#3162)
* Add docs and examples for path templating Signed-off-by: Jackie Elliott <[email protected]> * Clarify path segment vs glob Signed-off-by: Jackie Elliott <[email protected]> * rebase Signed-off-by: Jackie Elliott <[email protected]> * Update docs to reflect more restrictive path templating support Signed-off-by: Jackie Elliott <[email protected]> * Clarify an invalid path template will result in a invalid auth policy. Signed-off-by: Jackie Elliott <[email protected]> --------- Signed-off-by: Jackie Elliott <[email protected]>
1 parent e481111 commit 5b08a31

File tree

6 files changed

+456
-0
lines changed

6 files changed

+456
-0
lines changed

kubernetes/customresourcedefinitions.gen.yaml

Lines changed: 384 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

security/v1/authorization_policy.pb.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

security/v1/authorization_policy.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,20 @@ message Operation {
521521
// for details of the path normalization.
522522
// For gRPC service, this will be the fully-qualified name in the form of `/package.service/method`.
523523
//
524+
// If a path in the list contains the `{*}` or `{**}` path template operator, it will be interpreted as an [Envoy Uri Template](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/path/match/uri_template/v3/uri_template_match.proto).
525+
// To be a valid path template, the path must not contain `*`, `{`, or `}` outside of a supported operator. No other characters are allowed in the path segment with the path template operator.
526+
// - `{*}` matches a single glob that cannot extend beyond a path segment.
527+
// - `{**}` matches zero or more globs. If a path contains `{**}`, it must be the last operator.
528+
//
529+
// Examples:
530+
// - `/foo/{*}` matches `/foo/bar` but not `/foo/bar/baz`
531+
// - `/foo/{**}/` matches `/foo/bar/`, `/foo/bar/baz.txt`, and `/foo//` but not `/foo/bar`
532+
// - `/foo/{*}/bar/{**}` matches `/foo/buzz/bar/` and `/foo/buzz/bar/baz`
533+
// - `/*/baz/{*}`` is not a valid path template since it includes `*` outside of a supported operator
534+
// - `/**/baz/{*}`` is not a valid path template since it includes `**` outside of a supported operator
535+
// - `/{**}/foo/{*}` is not a valid path template since `{**}` is not the last operator
536+
// - `/foo/{*}.txt` is invalid since there are characters other than `{*}` in the path segment
537+
//
524538
// If not set, any path is allowed. Must be used only with HTTP.
525539
repeated string paths = 4;
526540

security/v1beta1/authorization_policy.pb.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

security/v1beta1/authorization_policy.pb.html

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

security/v1beta1/authorization_policy.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,20 @@ message Operation {
520520
// for details of the path normalization.
521521
// For gRPC service, this will be the fully-qualified name in the form of `/package.service/method`.
522522
//
523+
// If a path in the list contains the `{*}` or `{**}` path template operator, it will be interpreted as an [Envoy Uri Template](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/path/match/uri_template/v3/uri_template_match.proto).
524+
// To be a valid path template, the path must not contain `*`, `{`, or `}` outside of a supported operator. No other characters are allowed in the path segment with the path template operator.
525+
// - `{*}` matches a single glob that cannot extend beyond a path segment.
526+
// - `{**}` matches zero or more globs. If a path contains `{**}`, it must be the last operator.
527+
//
528+
// Examples:
529+
// - `/foo/{*}` matches `/foo/bar` but not `/foo/bar/baz`
530+
// - `/foo/{**}/` matches `/foo/bar/`, `/foo/bar/baz.txt`, and `/foo//` but not `/foo/bar`
531+
// - `/foo/{*}/bar/{**}` matches `/foo/buzz/bar/` and `/foo/buzz/bar/baz`
532+
// - `/*/baz/{*}`` is not a valid path template since it includes `*` outside of a supported operator
533+
// - `/**/baz/{*}`` is not a valid path template since it includes `**` outside of a supported operator
534+
// - `/{**}/foo/{*}` is not a valid path template since `{**}` is not the last operator
535+
// - `/foo/{*}.txt` is invalid since there are characters other than `{*}` in the path segment
536+
//
523537
// If not set, any path is allowed. Must be used only with HTTP.
524538
repeated string paths = 4;
525539

0 commit comments

Comments
 (0)