Skip to content

Commit 079ddf8

Browse files
authored
Merge pull request #9409 from AriaXLi/backport_PUP-12047
(PUP-12047) Add logic to skip MD5 checksum method on a FIPS system
2 parents 20775a9 + e4fdad2 commit 079ddf8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/puppet/file_serving/http_metadata.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ def initialize(http_response, path = '/dev/null')
5151
def collect
5252
# Prefer the checksum_type from the indirector request options
5353
# but fall back to the alternative otherwise
54-
[ @checksum_type, :sha256, :sha1, :md5, :mtime ].each do |type|
54+
[@checksum_type, :sha256, :sha1, :md5, :mtime].each do |type|
55+
next if type == :md5 && Puppet::Util::Platform.fips_enabled?
56+
5557
@checksum_type = type
5658
@checksum = @checksums[type]
5759
break if @checksum

spec/unit/file_serving/http_metadata_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
expect( metadata.mode ).to be_nil
3030
end
3131

32+
it "skips md5 checksum type in collect on FIPS enabled platforms" do
33+
allow(Puppet::Util::Platform).to receive(:fips_enabled?).and_return(true)
34+
http_response['X-Checksum-Md5'] = 'c58989e9740a748de4f5054286faf99b'
35+
metadata = described_class.new(http_response)
36+
metadata.collect
37+
expect( metadata.checksum_type ).to eq :mtime
38+
end
39+
3240
context "with no Last-Modified or Content-MD5 header from the server" do
3341
it "should use :mtime as the checksum type, based on current time" do
3442
# Stringifying Time.now does some rounding; do so here so we don't end up with a time

0 commit comments

Comments
 (0)