Skip to content

Commit 2e2e5a7

Browse files
committed
Generate checksums for release artifacts in CI
One of the major complains surrounding the recent XZ fiasco is that auto-tools generated source files include so much obtuse code that they are difficult to audit. Also it isn't immediately apparent what sources they have been generated from. In our case we're generating the source dist files in CI anyway and automatically attaching them to releases, but GH does not make it possible to verify this. They could just as well be reposted later by a malicious maintainer. This is not a magic bullet to fix all that, but it should help. The CI environment can be verified by looking at the workflow file and the other Git sources so we're not using a modified version of autotools or anything like that. Checksums are now being generated after making the distribution tarballs, and *echoed to the output log* so it is possible to verify that the files generated in CI are actually still the ones attached to the release. The checksums file is also posted to the release.
1 parent a46a8b9 commit 2e2e5a7

File tree

6 files changed

+27
-2
lines changed

6 files changed

+27
-2
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
./configure --with-standalone --bindir=/
2121
make DESTDIR=. install-exec
2222
echo VERSION=$(cat .version) >> $GITHUB_ENV
23+
sha256sum vcsh-standalone.sh
2324
- name: Post standalone script artifact
2425
uses: actions/upload-artifact@v4
2526
with:

.github/workflows/release.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
files: |
4444
vcsh-${{ env.VERSION }}.tar.zst
4545
vcsh-${{ env.VERSION }}.zip
46+
vcsh-${{ env.VERSION }}.sha256.txt
4647
4748
deploy-standalone:
4849
runs-on: ubuntu-latest
@@ -56,9 +57,11 @@ jobs:
5657
./bootstrap.sh
5758
./configure --with-standalone --bindir=/
5859
make DESTDIR=. install-exec
60+
sha256sum vcsh-standalone.sh | tee vcsh-standalone.sha256.txt
5961
- name: Add standalone deployment to release
6062
uses: svenstaro/upload-release-action@v2
6163
with:
6264
repo_token: ${{ github.token }}
63-
file: vcsh-standalone.sh
6465
tag: ${{ github.ref }}
66+
file_glob: true
67+
file: vcsh-standalone.{sh,sha256.txt}

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ BUILT_SOURCES =
2424
CLEANFILES = $(dist_man_MANS) $(bin_SCRIPTS)
2525

2626
include $(top_srcdir)/build-aux/git_version.mk
27+
include $(top_srcdir)/build-aux/dist_checksums.mk
2728
include $(top_srcdir)/build-aux/shell_completion_dirs.mk
2829

2930
if !IS_SDIST

build-aux/ax_dist_checksums.m4

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AC_DEFUN([AX_DIST_CHECKSUMS], [
2+
3+
AX_PROGVAR([sha256sum])
4+
AX_PROGVAR([tee])
5+
6+
])

build-aux/dist_checksums.mk

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Output both a file that can be attatched to releases and also write STDOUT
2+
# for the sake of CI build logs so they can be audited as matching what is
3+
# eventually posted. The list of files checksummed is a glob (even though we
4+
# know an exact pattern) to avoid errors for formats not generated.
5+
checksum_dist = \
6+
shopt -s nullglob ; \
7+
$(SHA256SUM) $(distdir)*.{tar.{gz,bz2,lz,xz,zst},zip} |\
8+
$(TEE) $(distdir).sha256.txt
9+
10+
CLEANFILES += $(distdir).sha256.txt
11+
12+
# Append checksum operation to function that runs after compressing dist archives
13+
am__post_remove_distdir = $(am__remove_distdir); $(checksum_dist)

configure.ac

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ AC_ARG_WITH([standalone],
2828
],
2929
[])
3030

31-
# These three macros must be run after processing our standalone setup because
31+
# These macros must be run after processing our standalone setup because
3232
# they all expect the program name transformation setup to be complete.
3333
AX_GIT_VERSION
34+
AX_DIST_CHECKSUMS
3435
AX_SHELL_COMPLETION_DIRS
3536
AX_TRANSFORM_PACKAGE_NAME
3637

0 commit comments

Comments
 (0)