ingress-nginx: Wrong validation for permanent-redirect and temporal-redirect annotation values
Hi everyone,
I think in this file there is a wrong validator for the values of permanent-redirect and temporal-redirect annotation used.
Reasoning: It should be possible to use variables like “$request_uri” for redirecting to the same path as in the original request for example, but this is blocked by the validation because the $ is not allowed. If I use a configuration-snippet with the following content, it works fine:
return 301 https://wheelscompany.com/$request_uri;
So for me it looks like if URLWithNginxVariableRegex should be the correct Regex to be used at this point.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 38
- Comments: 16 (2 by maintainers)
Same problem here after upgrading from helm chart 4.11.4 to 4.12.0
http://nginx.ingress.kubernetes.io/permanent-redirect: https://www.domain.com/$redirect_uri👍 This is blocking upgrade for us, with multiple high CVSS scores.
We also hit this in Prod yesterday with 4.12.2.
confirm the same issue with
$redirect_urion 4.12.1Just hit this issue today when I started debugging why my redirect (which I was pretty sure worked) doesn’t work anymore.
I can confirm it’s problem with v1.12. Rolling back to Helm Chart 4.11.4 (which is latest chart before 1.12, and installs 1.11.4) resolved issue.
Just to add on, auth-sign in validation appears broken when updating from
v1.11.3tov1.12.0as well:EDIT: Looking a bit deeper, auth-signin already uses
URLWithNginxVariableRegex, so this error this is likely due to the URL encoded characters in the address. This is working onv1.11.3, so not sure what has changed since that release, however potentially not related to this issue.@lindhe No, those issues are older and what the OP (and us) are trying was working just fine with Helm version 4.11.3 (as @MiGrandjean said as well).
@Vierlip We just installed 4.12.2 and the issue is still there. We will be reverting to a 4.11 version until we hear back from the team.
This is grave; having “invalid” values causes the annot to be ignored.
The Ingress though is still processed, without the annotation.
In cases of annots like
nginx.ingress.kubernetes.io/auth-urlet al, this will leave your previously-fine Ingress now fully unprotected.Please make the whole Ingress fail if any annotations fail validation.
Have you tried setting:
ATTENTION tthis does not validate the annotaation anymore and let’s sth like $redirect_uri in there through, but it could potentially brake your nginx configuration being reloaded
Relference: https://github.com/kubernetes/ingress-nginx/releases/tag/controller-v1.12.1