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
Add string sanitisation for proxy-pass-headers & proxy-hide-headers (#2730)
* Add example annotaiton validation function
* Add validation for proxy-hide-headers
* Create unit tests for proxy header validation
* Update documentation
* Revert example yaml files
* Initialize allErrs field to zero value
* Update function name
Co-authored-by: “shaun-nx” <“s.odonovan@f5.com”>
Co-authored-by: Haywood Shannon <5781935+haywoodsh@users.noreply.github.com>
msg: "valid nginx.org/proxy-hide-headers annotation, multi-value with spaces",
736
+
},
737
+
{
738
+
annotations: map[string]string{
739
+
"nginx.org/proxy-hide-headers": "$header1",
740
+
},
741
+
specServices: map[string]bool{},
742
+
isPlus: false,
743
+
appProtectEnabled: false,
744
+
appProtectDosEnabled: false,
745
+
internalRoutesEnabled: false,
746
+
expectedErrors: []string{
747
+
`annotations.nginx.org/proxy-hide-headers: Invalid value: "$header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-hide-headers: Invalid value: "{header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-hide-headers: Invalid value: "$header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-hide-headers: Invalid value: "$header2": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
790
+
},
791
+
msg: "invalid nginx.org/proxy-hide-headers annotation, multi-value containing '$' after valid header",
msg: "valid nginx.org/proxy-pass-headers annotation, multi-value with spaces",
828
+
},
829
+
{
830
+
annotations: map[string]string{
831
+
"nginx.org/proxy-pass-headers": "$header1",
832
+
},
833
+
specServices: map[string]bool{},
834
+
isPlus: false,
835
+
appProtectEnabled: false,
836
+
appProtectDosEnabled: false,
837
+
internalRoutesEnabled: false,
838
+
expectedErrors: []string{
839
+
`annotations.nginx.org/proxy-pass-headers: Invalid value: "$header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-pass-headers: Invalid value: "{header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-pass-headers: Invalid value: "$header1": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
`annotations.nginx.org/proxy-pass-headers: Invalid value: "$header2": a valid HTTP header must consist of alphanumeric characters or '-' (e.g. 'X-Header-Name', regex used for validation is '[-A-Za-z0-9]+')`,
882
+
},
883
+
msg: "invalid nginx.org/proxy-pass-headers annotation, multi-value containing '$' after valid header",
0 commit comments