Skip to content
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

Set Read/ReadHeaderTimeouts on http.Server #5340

Merged
merged 1 commit into from
Feb 16, 2023

Conversation

mrueg
Copy link
Contributor

@mrueg mrueg commented Feb 14, 2023

Description

via gosec linter - G112: Potential slowloris attack

https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.

Set Read/ReadHeaderTimeouts on http.Server instances

@mrueg mrueg requested a review from a team as a code owner February 14, 2023 11:35
Copy link
Contributor

@JoaoBraveCoding JoaoBraveCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, that's neat! Thanks for the contribution!

@philipgough
Copy link
Contributor

philipgough commented Feb 14, 2023

I am not convinced about this change if I am honest, particularly the hardcoded nature of the value. Perhaps making them configurable might make sense but my gut feeling tells me that this could/should be mitigated at ingress/proxy layer if required. The client here is expected to be Kubernetes itself.

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, the timeout for webhook configurations has to be between 1 second and 30 seconds, with a default of 10s for v1 (ref). I'd be ok with a hardcoded timeout value of 30s so we don't introduce a potentially breaking change.
In addition we should evaluate if there's value in enabling the gosec linter. My first impression is that it's a bit noisy but I haven't looked very deep.

Default to 30s

via gosec linter - G112: Potential slowloris attack

https://medium.com/a-journey-with-go/go-understand-and-mitigate-slowloris-attack-711c1b1403f6
Signed-off-by: Manuel Rüger <manuel@rueg.eu>
Copy link
Contributor

@philipgough philipgough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@simonpasquier simonpasquier merged commit f9d8747 into prometheus-operator:main Feb 16, 2023
@simonpasquier
Copy link
Contributor

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants