1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 14:58:08 +00:00

Add protocol validation when downloading blocklist from URL (#5698)

This commit is contained in:
yubiuser 2024-07-07 07:37:29 +02:00 committed by GitHub
commit 8b324741e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -622,6 +622,12 @@ gravity_DownloadBlocklistFromUrl() {
fi fi
fi fi
# Check for allowed protocols
if [[ $url != "http"* && $url != "https"* && $url != "file"* && $url != "ftp"* && $url != "ftps"* && $url != "sftp"* ]]; then
echo -e "${OVER} ${CROSS} ${str} Invalid protocol specified, ignoring list"
download=false
fi
if [[ "${download}" == true ]]; then if [[ "${download}" == true ]]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
httpCode=$(curl --connect-timeout ${curl_connect_timeout} -s -L ${compression} ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" "${url}" -o "${listCurlBuffer}" 2>/dev/null) httpCode=$(curl --connect-timeout ${curl_connect_timeout} -s -L ${compression} ${cmd_ext} ${heisenbergCompensator} -w "%{http_code}" "${url}" -o "${listCurlBuffer}" 2>/dev/null)