summaryrefslogtreecommitdiffstats
path: root/scripts/git-hooks/commit-msg
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2026-02-28 11:09:26 +0000
committerPádraig Brady <P@draigBrady.com>2026-03-04 22:17:39 +0000
commitb3fe24213ee350835097cefa8d0154f78ffd9d67 (patch)
tree8c7a884decfa1937ae3601e29ebca18fddcf6cb6 /scripts/git-hooks/commit-msg
parente24372e6d0f10ab54c3c387930246c5e66f40a34 (diff)
downloadcoreutils-b3fe24213ee350835097cefa8d0154f78ffd9d67.tar.gz
coreutils-b3fe24213ee350835097cefa8d0154f78ffd9d67.zip
cksum: use more defensive escaping for --check
cksum --check is often the first interaction users have with possibly untrusted downloads, so we should try to be as defensive as possible when processing it. Specifically we currently only escape \n characters in file names presented in checksum files being parsed with cksum --check. This gives some possibilty of dumping arbitrary data to the terminal when checking downloads from an untrusted source. This change gives these advantages: 1. Avoids dumping arbitrary data to vulnerable terminals 2. Avoids visual deception with ansi codes hiding checksum failures 3. More secure if users copy and paste file names from --check output 4. Simplifies programmatic parsing Note this changes programmatic parsing, but given the original format was so awkward to parse, I expect that's extremely rare. I was not able to find example in the wild at least. To parse the new format from from shell, you can do something like: cksum -c checksums | while IFS= read -r line; do case $line in *': FAILED') filename=$(eval "printf '%s' ${line%: FAILED}") cp -v "$filename" /quarantine ;; esac done This change also slightly reduces the size of the sum(1) utility. This change also apples to md5sum, sha*sum, and b2sum. * src/cksum.c (digest_check): Call quotef() instead of cksum(1) specific quoting. * tests/cksum/md5sum-bsd.sh: Adjust accordingly. * doc/coreutils.texi (cksum general options): Describe the shell quoting used for problematic file names. * NEWS: Mention the change in behavior. Reported by: Aaron Rainbolt
Diffstat (limited to 'scripts/git-hooks/commit-msg')
0 files changed, 0 insertions, 0 deletions