diff --git a/scripts/install.sh b/scripts/install.sh index 8814dc4f..b76b8ba3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -161,6 +161,12 @@ ensure_cosign() { *) return 1 ;; esac + # COSIGN_VERSION is env-overridable and gets interpolated into the Sigstore + # download URL, so it needs the same semver + path-traversal gate as the + # release tag — a crafted value must not redirect which release path we fetch. + validate_version_tag "$COSIGN_VERSION" "cosign version" \ + "Set COSIGN_VERSION to a published cosign release tag (e.g. v2.4.1)." + cbase="https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}" casset="cosign-${OS}-${cosign_arch}" cbin="$TMP/cosign" @@ -196,7 +202,7 @@ resolve_tag() { # Use the redirect-trail of /releases/latest to learn the tag — # avoids hitting the rate-limited /api/repos endpoint for the # zero-auth one-liner case. - redirect_url="$(curl -fsSI \ + redirect_url="$(curl -fsSI --tlsv1.2 \ "https://github.com/${GITHUB_REPO}/releases/latest" \ | awk '/^[Ll]ocation:/ { print $2 }' \ | tr -d '\r')" @@ -219,24 +225,32 @@ resolve_tag() { # most security-sensitive download in the installer. Constrain it to a release # tag shape and refuse any '/' or '..' (RFC-0001 R8, backend#889). Matches the # client bootstrap's gate (^v[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9.]+)?$). -validate_tag() { +# validate_version_tag