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

feat(fips): disallow non-compliant crypto in fingerprint processor #42598

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kruskall
Copy link
Member

@kruskall kruskall commented Feb 5, 2025

Proposed commit message

do not allow md5 and sha1 config values in fingerprint processor

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

do not allow md5 and sha1 config values in fingerprint processor
@kruskall kruskall requested a review from a team as a code owner February 5, 2025 02:14
@kruskall kruskall requested review from faec and leehinman February 5, 2025 02:14
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 5, 2025
@botelastic
Copy link

botelastic bot commented Feb 5, 2025

This pull request doesn't have a Team:<team> label.

Copy link
Contributor

mergify bot commented Feb 5, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @kruskall? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit

)

var namedHashMethods = []namedHashMethod{
{Name: "md5", Hash: md5.New},
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants