Skip to content

Commit ac0c248

Browse files
committed
Enforce strict HTTPS usage in install.sh HTTP requests
Improved security and reliability by enforcing HTTPS-only connections for all curl and wget requests in getLatestRelease, downloadFile, and isReleaseAvailable. Added --proto="=https" for curl and --max-redirect=0 for wget to prevent insecure redirects and ensure all downloads use HTTPS. #34
1 parent 6b7e03e commit ac0c248

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎install/install.sh‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ getLatestRelease() {
105105
local latest_release=""
106106

107107
if [[ "$HTTP_REQUEST_VECTRACTL" == "curl" ]]; then
108-
latest_release=$(curl -s "$vectractl_release_url" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
108+
latest_release=$(curl -s --proto "=https" "$vectractl_release_url" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
109109
else
110-
latest_release=$(wget -q --https-only --header="Accept: application/json" -O - "$vectractl_release_url" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
110+
latest_release=$(wget -q --max-redirect=0 --https-only --header="Accept: application/json" -O - "$vectractl_release_url" | grep \"tag_name\" | grep -v rc | awk 'NR==1{print $2}' | sed -n 's/\"\(.*\)\",/\1/p')
111111
fi
112112

113113
if [[ -z "$latest_release" ]]; then
@@ -131,9 +131,9 @@ downloadFile() {
131131

132132
echo "Downloading $DOWNLOAD_URL ..."
133133
if [[ "$HTTP_REQUEST_VECTRACTL" == "curl" ]]; then
134-
curl -SsL --proto-redir =https "$DOWNLOAD_URL" -o "$ARTIFACT_TMP_FILE"
134+
curl -SsL --proto =https "$DOWNLOAD_URL" -o "$ARTIFACT_TMP_FILE"
135135
else
136-
wget -q --https-only -O "$ARTIFACT_TMP_FILE" "$DOWNLOAD_URL"
136+
wget -q --max-redirect=0 --https-only -O "$ARTIFACT_TMP_FILE" "$DOWNLOAD_URL"
137137
fi
138138

139139
if [[ ! -f "$ARTIFACT_TMP_FILE" ]]; then
@@ -151,12 +151,12 @@ isReleaseAvailable() {
151151
DOWNLOAD_URL="${DOWNLOAD_BASE}/${LATEST_RELEASE_TAG}/${VECTRACTL_ARTIFACT}"
152152

153153
if [[ "$HTTP_REQUEST_VECTRACTL" == "curl" ]]; then
154-
httpstatus=$(curl -sSLI --proto-redir =https -o /dev/null -w "%{http_code}" "$DOWNLOAD_URL")
154+
httpstatus=$(curl -sSLI --proto "=https" -o /dev/null -w "%{http_code}" "$DOWNLOAD_URL")
155155
if [[ "$httpstatus" == "200" ]]; then
156156
return 0
157157
fi
158158
else
159-
wget -q --https-only --spider "$DOWNLOAD_URL"
159+
wget -q --max-redirect=0 --https-only --spider "$DOWNLOAD_URL"
160160
exitstatus=$?
161161
if [[ $exitstatus -eq 0 ]]; then
162162
return 0

0 commit comments

Comments
 (0)