support/download: enforce BR2_DOWNLOAD_FORCE_CHECK_HASHES=y for missing hash files

BR2_DOWNLOAD_FORCE_CHECK_HASHES=y is supposed to make the build fail
if any download cannot be successfully verified against a known
hash. However, support/download/check-hash would only warn if there
was no hash file at all for the package in question, and allow the
build to continue.

This is a security fix and should be backported to all stable
branches.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fiona Klute
2026-10-18 14:09:40 +02:00
committed by Peter Korsgaard
parent 0f592d0eae
commit 42340d022f
2 changed files with 2 additions and 1 deletions

View File

@@ -116,6 +116,7 @@ define DOWNLOAD
SFTP="$(call qstrip,$(BR2_SFTP))" \
SVN="$(call qstrip,$(BR2_SVN))" \
WGET="$(call qstrip,$(BR2_WGET))" \
BR2_DOWNLOAD_FORCE_CHECK_HASHES="$(BR2_DOWNLOAD_FORCE_CHECK_HASHES)" \
BR_NO_CHECK_HASH_FOR="$(if $(BR2_DOWNLOAD_FORCE_CHECK_HASHES),,$(BR_NO_CHECK_HASH_FOR))" \
flock $($(PKG)_DL_DIR)/.lock $(DL_WRAPPER) \
-c '$($(PKG)_DL_VERSION)' \

View File

@@ -98,7 +98,7 @@ for h_file in "${h_files[@]}"; do
done
# shellcheck disable=SC2086 # nb_h_files is a non-empty int
if [ ${nb_h_files} -eq 0 ]; then
if [ ${nb_h_files} -eq 0 ] && [ "$BR2_DOWNLOAD_FORCE_CHECK_HASHES" != y ]; then
printf "WARNING: no hash file for %s\n" "${base}" >&2
exit 0
fi