Skip to content

Commit

Permalink
* Renamed UnescapeRedirect to UnescapeAndRedirect
Browse files Browse the repository at this point in the history
* Renamed UnescapeForward to UnescapeAndForward

Signed-off-by: Lior Okman <[email protected]>
  • Loading branch information
liorokman committed Jan 5, 2024
1 parent 063bde4 commit 642cff7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions api/v1alpha1/pathsettings_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package v1alpha1

// PathEscapedSlashAction determines the action for requests that contain %2F, %2f, %5C, or %5c
// sequences in the URI path.
// +kubebuilder:validation:Enum=KeepUnchanged;RejectRequest;UnescapeForward;UnescapeRedirect
// +kubebuilder:validation:Enum=KeepUnchanged;RejectRequest;UnescapeAndForward;UnescapeAndRedirect
type PathEscapedSlashAction string

const (
Expand All @@ -19,7 +19,7 @@ const (
// The "httpN.downstream_rq_failed_path_normalization" counter is incremented
// for each rejected request.
RejectRequestAction PathEscapedSlashAction = "RejectRequest"
// UnescapeRedirect unescapes %2F and %5C sequences and redirects to the new path
// UnescapeAndRedirect unescapes %2F and %5C sequences and redirects to the new path
// if these sequences were present.
//
// Redirect occurs after path normalization and merge slashes transformations if
Expand All @@ -30,18 +30,18 @@ const (
// proxies, Envoy and upstream server.
// The “httpN.downstream_rq_redirected_with_normalized_path” counter is incremented
// for each redirected request.
UnescapeRedirect PathEscapedSlashAction = "UnescapeRedirect"
// UnescapeForward unescapes %2F and %5C sequences and forwards the request.
UnescapeAndRedirect PathEscapedSlashAction = "UnescapeAndRedirect"
// UnescapeAndForward unescapes %2F and %5C sequences and forwards the request.
// Note: this option should not be enabled if intermediaries perform path based access
// control as it may lead to path confusion vulnerabilities.
UnescapeForward PathEscapedSlashAction = "UnescapeForward"
UnescapeAndForward PathEscapedSlashAction = "UnescapeAndForward"
)

// PathSettings provides settings that managing how the incoming path set by clients is handled.
type PathSettings struct {
// EscapedSlashesAction determines how %2f, %2F, %5c, or %5C sequences in the path URI
// should be handled.
// The default is UnescapeRedirect.
// The default is UnescapeAndRedirect.
//
// +optional
EscapedSlashesAction *PathEscapedSlashAction `json:"escapedSlashesAction,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ spec:
escapedSlashesAction:
description: EscapedSlashesAction determines how %2f, %2F, %5c,
or %5C sequences in the path URI should be handled. The default
is UnescapeRedirect.
is UnescapeAndRedirect.
enum:
- KeepUnchanged
- RejectRequest
- UnescapeForward
- UnescapeRedirect
- UnescapeAndForward
- UnescapeAndRedirect
type: string
type: object
suppressEnvoyHeaders:
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/latest/api/extension_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ _Appears in:_

| Field | Description |
| --- | --- |
| `escapedSlashesAction` _[PathEscapedSlashAction](#pathescapedslashaction)_ | EscapedSlashesAction determines how %2f, %2F, %5c, or %5C sequences in the path URI should be handled. The default is UnescapeRedirect. |
| `escapedSlashesAction` _[PathEscapedSlashAction](#pathescapedslashaction)_ | EscapedSlashesAction determines how %2f, %2F, %5c, or %5C sequences in the path URI should be handled. The default is UnescapeAndRedirect. |
| `disableMergeSlashes` _boolean_ | DisableMergeSlashes allows disabling the default configuration of merging adjacent slashes in the path. Note that slash merging is not part of the HTTP spec and is provided for convenience. |


Expand Down

0 comments on commit 642cff7

Please sign in to comment.