-
Notifications
You must be signed in to change notification settings - Fork 4.9k
x-pack/libbeat/common/cloudfoundry: Use xxhash instead of SHA1 in FIPS mode #43964
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
base: main
Are you sure you want to change the base?
Conversation
This pull request doesn't have a |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
package cloudfoundry | ||
|
||
import ( | ||
"crypto/sha256" |
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.
question: do we need a cryptographic function ? If not, I'd suggest we use a non-cryptographic func (e.g. xxhash) to make this more future-proof.
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.
Yes makes sense. I'll do this.
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
//go:build !requirefips |
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.
question: Can we update the cache key for everyone ? Would this be considered a breaking change ?
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.
I am also not sure about this. Since sha1.Sum
is deterministic, it will always produce the same hash for a fixed input (in this case, the APIAddress). This deterministic behavior means the system might create or reuse a (persistent) cache based on this hash value.
For users who already have that persistent cache in place, changing this logic could potentially be a breaking change. Although it's just a cache implementation detail, I haven't deeply investigated this issue since I haven't worked with cloudfoundry before.
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.
It would be nice to better understand the implications of changing the cache key so we could assess whether it makes sense to use a single implementation to FIPS and non-FIPS.
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.
I believe it ends up being just a variation of the same question asked by @kruskall: what happens if someone upgrades Beats to the FIPS version? Is this upgrade even supported?
Proposed commit message
Drop usage of SHA1 and replace with a better algorithm when running in FIPS mode (
-requirefips
).Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.