You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reject csrf additionalOrigins that carry a scheme or path
Envoy strips the scheme from the Origin header before matching, and the header
never carries a path, so a value like `https://www.example.com` is accepted by
the CRD but can never match, silently 403ing legitimate requests. Add a CEL
rule on the CSRF type that rejects such values at admission, with cel-validation
coverage for the valid host / host:port forms and the scheme and path forms.
Also point the Gateway/HTTPRoute/GRPCRoute links in the CSRF task doc at
/reference/api-types/, matching the other task docs; the old /api-types/ paths
404 and broke docs-check-links.
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Copy file name to clipboardExpand all lines: api/v1alpha1/csrf_types.go
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ import (
18
18
// (the scheme is stripped before matching). Additional origins must be specified as
19
19
// host or host:port values, not full URLs. For example, use "www.example.com"
20
20
// instead of "https://www.example.com".
21
+
//
22
+
// +kubebuilder:validation:XValidation:message="additionalOrigins must be host or host:port values without a scheme or path, for example www.example.com instead of https://www.example.com",rule="!has(self.additionalOrigins) || self.additionalOrigins.all(o, !o.value.contains('/'))"
21
23
typeCSRFstruct {
22
24
// EnforcedFraction represents the fraction of requests for which the CSRF
23
25
// policy is enforced. Requests that are not selected are allowed through
0 commit comments