1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-21 14:28:07 +00:00

Add protocol validation when downloading blocklist from URL

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2024-04-30 15:47:57 +02:00 committed by Adam Warner
parent 548e142406
commit 2c497a9a3e

View File

@ -586,6 +586,12 @@ gravity_DownloadBlocklistFromUrl() {
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
# 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)