-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nginx panics when cors-allow-origin
contains invalid input
#8168
Comments
cors-allow-origin
contains invalid cors-allow-origin
contains invalid input
@L1ghtman2k , thanks for reporting this. @theunrealgeek , I thought we blocked bad stuff only. Wonder if you also can reproduce this panic /triage accepted |
/assign theunrealgeek |
@longwuyuan: GitHub didn't allow me to assign the following users: theunrealgeek. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hello, Yes, I am able to reproduce the issue on v1.1.1. You can test it in a small local kind cluster too:
Apply nginx helm-chart:
Wait for the ingress controller to become available, and then:
|
ok. I saw the error in the logs and I also see that specificing the correct format created the ingress But the controller is not dead after that error. So it seems we should handle that invalid input better. At least just log one more line of a friendlier message to user as root cause is just missing format (required protocol like http or https there) |
@longwuyuan correct, however, if someone has that invalid object in the environment, prior to upgrading, and then migrates to v1 nginx from v0, that will crash the controller, since (my guess) panics are not recovered outside of the validation step. In any case, like you mentioned, handling invalid input should fix the above too |
I'll wait for @theunrealgeek or others to comment as I am not a
developer. But I saw just now that if the value for that annotation is
invalid, then the ingress object can not even be created. The admission
webhook is catching that already or so it seems.
Thanks,
; Long Wu Yuan
…On 1/20/22 11:19 AM, Aibek wrote:
@longwuyuan <https://github.com/longwuyuan> correct, however, note
that |Anything else we need to know| section in the first message. If
someone has that invalid object in the environment, prior to
upgrading, and then migrates to v1 nginx from v0, that will crash the
controller, since my guess is that panics are not recovered outside of
validation step
—
Reply to this email directly, view it on GitHub
<#8168 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGZVWQ6SEXMADDYPCMP5MLUW6O63ANCNFSM5MLH5SAQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey there, so having a quick look this is an issue directly during parsing of annotations. It happens when everything in the slice is invalid. If just one turns out to be |
@larivierec I did not test yet but did you mean , the below works without panic ;
I have to check but there is no protocol in the last FQDN in thsi example and secondly the last FQDN is actually a repeated one. So what invalidates and causes the panic. The missing protocol or the repeat |
@longwuyuan, I think @larivierec meant: If one turns out to be And from your example above: |
Thanks @L1ghtman2k . I am not a developer and these are times I wish I was. |
Yes exactly, my fault. Mobile keyboards cause more confusion sometimes then help. 😅 Thanks for the clarification |
/priority important-soon |
…ubernetes#8185) * fixes kubernetes#8168 by appending elements on match, instead of removing * refactor the corsOriginRegex comparison, and initialize CorsAllowOrigin
NGINX Ingress controller version : v1.1.0
Kubernetes version (use
kubectl version
):Environment: EKS
Cloud provider or hardware configuration: AWS
OS (e.g. from /etc/os-release): Amazon Linux 2
How was the ingress-nginx-controller installed: https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.0/deploy/static/provider/cloud/deploy.yaml
Current State of the controller:
What happened:
Applying the Ingress to Nginx v1.1.0 that has invalid
cors-allow-origin
will cause the Nginx validation webhook to panic(the panic during validation webhook is recovered, so the actual Nginx instance is still operational):This is what the client sees when trying to create an Ingress with invalid
cors-allow-origin
Logs on the Nginx controller yield the following:
What you expected to happen:
I expected nginx validation webhook to return back an error saying that provided
cors-allow-origin
contains illegal words. Perhaps provide that format thatcors-allow-origin
must follow:http(s)://example1.com,http(s)://example2.com
How to reproduce it:
Apply the following Ingress:
Anything else we need to know:
If someone is upgrading from versions v0 to >=v1.0.5, and they already have an invalid Ingress object in the environment prior to the upgrade, the upgrade will render nginx unusable since:
The text was updated successfully, but these errors were encountered: