Risk 3/5 · Elevated
PKGBUILD
Result #3114
Comment
The change replaces a pinned source tarball in `source=()` with a runtime download in `prepare()`, which bypasses Arch's normal source integrity model. The build now fetches from the network during package preparation, and if the first response is XML it parses a redirect URL out of the response body and downloads from that URL as well. That introduces an unvetted network dependency and makes the build trust remote metadata at build time rather than a fixed, checksum-covered source entry. Although the tarball is still SHA-256 checked before extraction, the redirect-following logic is brittle and expands the attack surface (e.g. any compromise or manipulation of the Qt download endpoint/redirect metadata can steer the build to arbitrary HTTPS content that only needs to match the hardcoded hash). This is a supply-chain integrity regression compared with the original PKGBUILD, so I rate it moderately risky.
@@ -14,14 +14,24 @@ makedepends=('qt5-tools' 'python' 'pciutils' 'libxtst' 'libxcursor' 'libxrandr'
'gperf' 'nss' 'clang' 'nodejs' 'ninja')
groups=('qt5')
_pkgfqn="qt-everywhere-opensource-src-${pkgver}"
-source=("https://download.qt.io/archive/qt/${pkgver%.*}/${pkgver}/single/$_pkgfqn.tar.xz"
- no-qmake.patch
+_qt_tarball="$_pkgfqn.tar.xz"
+_qt_sha256='173c2326dae138bbb0d98921e9d911e55c00163d93a6db29f294b5e19ff306ae'
+source=(no-qmake.patch
qt-everywhere-src-5.15.17-assimp.patch)
-sha256sums=('173c2326dae138bbb0d98921e9d911e55c00163d93a6db29f294b5e19ff306ae'
- 'db90fa31381fa0814c9c8c803c9e2f9b36bdd6f52da753399e500c0692352498'
+sha256sums=('db90fa31381fa0814c9c8c803c9e2f9b36bdd6f52da753399e500c0692352498'
'9d54e70051adfeed818db437f266e3bba5ccd2f5f9e056515281ee2f7ff71bac')
prepare() {
+ local _url="https://download.qt.io/archive/qt/${pkgver%.*}/${pkgver}/single/$_qt_tarball"
+ curl -fsSL -o "$_qt_tarball" "$_url"
+ if [ "$(head -c5 "$_qt_tarball")" = '<?xml' ]; then
+ _url=$(grep -oE '<url location="[^"]+" priority="[0-9]+">[^<]+</url>' "$_qt_tarball" | head -n1 | sed -E 's/^<url[^>]*>//; s@</url>$@@')
+ test -n "$_url"
+ curl -fsSL -o "$_qt_tarball" "$_url"
+ fi
+ echo "$_qt_sha256 $_qt_tarball" | sha256sum -c -
+ bsdtar -xf "$_qt_tarball"
+
cd ${_pkgfqn/opensource-/}
ln -s /usr/bin qttools/