Skip to main content

Chef/Correctness/InvalidChecksum

Cookstyle cops page

The Cookstyle cops department: Chef/Correctness

Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledNoAll Versions

The checksum property of the file downloading resources is a SHA-256 digest. An MD5 or SHA-1 digest can never match, so the resource fails the run with a checksum mismatch rather than installing anything.

Only digests that are unambiguously the wrong algorithm are flagged: 32 character (MD5) and 40 character (SHA-1) hex strings. Anything else is left alone.

Examples

# bad
remote_file '/tmp/foo.tar.gz' do
  source 'https://example.com/foo.tar.gz'
  checksum 'd41d8cd98f00b204e9800998ecf8427e'
end

# good
remote_file '/tmp/foo.tar.gz' do
  source 'https://example.com/foo.tar.gz'
  checksum 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
end

Configurable attributes

NameDefault valueConfigurable values
Version Added9.0.0String
Include
    Array

    Thank you for your feedback!

    ×