hadolint icon indicating copy to clipboard operation
hadolint copied to clipboard

Add check for two spaces in sha256sum input

Open rittneje opened this issue 4 years ago • 0 comments

  • [ ] This is a bug report
  • [x] This is a feature request
  • [x] I searched existing issues before opening this one

The Alpine version of sha256sum -c is stricter than others, in that it mandates there be two spaces between the hash and the file name in the input. If you only put a single space, then it will complain that the hashes don't match, instead of the actual error. (The Debian version for instance is more forgiving and accepts either format.)

It would be nice if hadolint were able to detect such usages. For example:

RUN ash << 'EOF'
set -eux -o pipefail
echo "${FILE_HASH} some_file.txt" | sha256sum -c
EOF

It could say something like "`sha256sum -c` may require two spaces between the hash and the filename".

This check should be performed for all the related utilities: sha512sum, etc.

rittneje avatar Apr 08 '22 04:04 rittneje