mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-25 23:52:04 +00:00
build: pin ffmpeg to a versioned URL and verify its sha256 unconditionally
The default build fetched /redirect/latest/ — a floating URL that changes under every build — and skipped the sha256 check whenever FFMPEG_SHA256 was empty, which it always was: neither the Dockerfile nor docker.yml carried a hash, so any binary the CDN served reached the image unverified and then processed untrusted media bytes. Both now pin the 9.0.2 release build with the hash the mirror publishes beside it (verified here by direct digest of the downloaded zip: fa8ecf4a…909d7f matches the sidecar), docker.yml's build-args fall back to the same pair, and the check is unconditional — an FFMPEG_URL override without its matching hash fails the build at the download step. The ffmpeg layer also moves above the dependency layer so a manifest/lock edit no longer re-downloads it (the old comment claimed caching 'unless FFMPEG_URL changes', which was never true), and the stale step reference in the sources comment goes with it. Local note: Git-Bash's sha256sum -c reads files in text mode here and cannot roundtrip anything binary — the -c line itself is standard and is exercised by the PR build in CI.
This commit is contained in:
@@ -150,9 +150,11 @@ jobs:
|
||||
# would give every new tag a cold cache on release builds. PR runs only
|
||||
# read it (cache-to is empty) so they cannot evict the release cache.
|
||||
#
|
||||
# FFMPEG_URL/FFMPEG_SHA256 come from repository variables when set, so a
|
||||
# release can pin an exact ffmpeg build (the Dockerfile default follows
|
||||
# the project's `/redirect/latest/` URL, which has no sha256 sidecar).
|
||||
# FFMPEG_URL/FFMPEG_SHA256 come from repository variables when set —
|
||||
# both or neither: the Dockerfile checks the sha256 unconditionally, so
|
||||
# a URL without its matching hash fails the build. The fallbacks pin the
|
||||
# same 9.0.2 release the Dockerfile defaults to (keep the three in step
|
||||
# when bumping).
|
||||
#
|
||||
# Single-arch (amd64) on purpose: adding arm64 means re-adding
|
||||
# `docker/setup-qemu-action`, `platforms: linux/amd64,linux/arm64`, and
|
||||
@@ -164,8 +166,8 @@ jobs:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
build-args: |
|
||||
APP_NAME=${{ env.APP_NAME }}
|
||||
FFMPEG_URL=${{ vars.FFMPEG_URL || 'https://ffmpeg.martin-riedl.de/redirect/latest/linux/amd64/release/ffmpeg.zip' }}
|
||||
FFMPEG_SHA256=${{ vars.FFMPEG_SHA256 }}
|
||||
FFMPEG_URL=${{ vars.FFMPEG_URL || 'https://ffmpeg.martin-riedl.de/download/linux/amd64/1789931100_9.0.2/ffmpeg.zip' }}
|
||||
FFMPEG_SHA256=${{ vars.FFMPEG_SHA256 || 'fa8ecf4abbd290d98f7d188b8649cc6b391ae209a98452be955a15aab1909d7f' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=tgxmb-build
|
||||
|
||||
Reference in New Issue
Block a user