-
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
Config: Do not log URL parameters. #12878
base: main
Are you sure you want to change the base?
Conversation
Welcome @RichardoC! |
Hi @RichardoC. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-ingress-nginx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
A bit more context CVSS 4 score 6.8 Affected versions: Add ability to customize upstream and stream log format Reproduction steps for logging the sensitive informationUse ingress-nginx as an ingress controller for a service that accepts sensitive values in url queries (such. as oauth) |
I can't trigger a rerun for these tests, but they're complaining with |
It would be nice if we could add a test to prevent regressions here, but I'm not sure where best to add a test for the format of a generated log line |
Could you please remove changes, which are not relevant to the actual purpose of your PR? That also re-triggers CI. |
Also keep in mind that users, that want to change this and prevent sensitive information from being logged, can also do this by configuring their own logging format. |
Of course, sorry about that. my IDE autoformatted 🤦 |
Yes, which is what I'm currently doing but logging sensitive details should be "opt out" rather than "opt in" in my opinion |
Ah, the tests broke as they're asserting based on information in the logs |
I know you commented on the tpoic please let me ask again. Is this optional or all users are going to get to your logformat change now ? |
This is optional, but all users would get it by default because the current "log sensitive information by default" isn't a great default in my opinion. |
You can help current users NOT experience a change, regardless of opinions, and make the use of your change optional. Please consider that forced opt-in is something that the project ends up needing to support and answer users on. Not to mention not having resources to sustain status-quo. |
As already discussed with the [email protected], the workaround for this is to manually override the log format, similar to the following in a values.yaml for the helm chart. That being said, this has caught me out every single time I've used this ingress controller for my job, leading to "fun" security incidents, and I was hoping I could convince the maintainers to use a more secure by default configuration to avoid other folks having the same pain. controller:
config:
log-format-upstream: $remote_addr - $remote_user [$time_local] "$request_method $uri $server_protocol" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id # Replaced $request with $uri to make sure we don't log url parameters
I hope this helps explain why I've opened this PR |
If users want to use their own custom format, either before or after this change they can set the following in their values.yaml Their existing custom logging configuration is unaffected by this change controller:
config:
log-format-upstream: SUPER CUSTOM LOGGING CONFIGURATION
|
Thanks for your contributions as that is the only way to improve the project. My request is related to impact. If this PR makes it optional and we get user feedback, then in a later PR we can make your change the default. That way the project will not force a opt-in. There are aspects of user experience, in the context of forced-op-in, that make me request this of you. |
It's already optional to have this change, so this is the "later PR we can make your change the default" PR. To repeat, users can already "opt in" to this behaviour and can if they want. That already exists. This PR is for the second stage of making it the default. The only difference I see if how we communicate when this change is coming, which I'll need help from the maintainers for. I hope this helps |
So after letting this settle a bit and finding the time to have another look, I basically agree with this change. Ingress NGINX should be secure by default and not expose a risk for people installing it without changing any of the default values. Of course we should also provide possibilities to still change behavior, even if this means the user's deployment gets less secure, but having such stuff configurable also makes it easier for us to change behavior in the future anyway. So overall LGTM, but as noticed before we also need to change the tests. I therefore triggered them once again. Regarding communication: We will handle this in the release notes of an upcoming v1.13, no worries. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/triage accepted
/kind feature
/priority backlog
/lgtm
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Gacko, RichardoC The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @Gacko , I'm happy to do the work to rewrite the tests, if you can point me to an existing pattern I can use to override the log config for one specific test |
What this PR does / why we need it:
The default logging configuration will capture the url query strings, which often have sensitive information in them [1]
This PR changes that behaviour so these are no longer logged by default.
This has already been reported to [email protected], and they said to open a public PR about it.
[1] https://owasp.org/www-community/vulnerabilities/Information_exposure_through_query_strings_in_url
Types of changes
Which issue/s this PR fixes
How Has This Been Tested?
Already running with this configuration on my own cluster
Checklist: