-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat(fips): disallow non-compliant crypto in fingerprint processor #42598
base: main
Are you sure you want to change the base?
Conversation
do not allow md5 and sha1 config values in fingerprint processor
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
|
) | ||
|
||
var namedHashMethods = []namedHashMethod{ | ||
{Name: "md5", Hash: md5.New}, |
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.
Nit.
Could we maybe move to where we have 2 slices, one FIPS approved and one Non-FIPS approved. Then something in a build tag that controls merging them into a slice with the correct values. What I've seen in previous FIPS approved products, keeping 2 separate lists in 2 separate files makes it very easy for them to get out of sync.
Even better if we could have one place in libbeat to update the list of approved hashes functions.
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.
mmh, that's the point. The two slices should be separate, they should never/not be synced. Any addition of a new hash method should not be automatically added in fips mode. It must be a manual process/decision.
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 was thinking of something like this:
// hash.go
// no build tag
var hashes = map[string]namedHashMethod{}
var fipsApprovedHashes = []namedHashMethod{
{Name: "sha512", Hash: sha512.New},
}
//hash_fips.go
////go:build requirefips
func init() {
for _, h := range fipsApprovedHashes {
hashes[h.Name] = h
}
}
//hash_nofips.go
//go:build !requirefips
var nonFipsApprovedHashes = []namedHashMethod{
{Name: "md5", Hash: md5.New},
}
func init() {
for _, h := range fipsApprovedHashes {
hashes[h.Name] = h
}
for _, h := range nonFipsApprovedHashes {
hashes[h.Name] = h
}
}
FIPS
hashes = fipsApprovedHashes
NonFips
hashes = fipsApprovedHashes + nonFipsApprovedHashes
Proposed commit message
do not allow md5 and sha1 config values in fingerprint processor
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs