Skip to content

ci/distribution: Switch to hermetic pgp signing tool (sq) - #47314

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
phlax:hermetic-pgp
Sep 10, 2026
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
phlax:hermetic-pgp

Conversation

@phlax

@phlax phlax commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

the existing setup protected the gpg secrets but was fragile and several (ie innocent) changes could have rendered its defenses moot

this moves the signer to a hermetic sq-based tool in toolshed

secrets are protected in 2 ways - firstly the bazel rule is set no-remote to prevent any caching, and secondly the rule requires a string_flag to a hardcoded absolute path containing any secrets

this prevents the secrets from ever appearing in any build graph, caches or otherwise leaking into the bazel ecosystem

@phlax
phlax marked this pull request as draft September 9, 2026 10:06
@repokitteh-read-only repokitteh-read-only Bot added the deps Approval required for changes to Envoy's external dependencies label Sep 9, 2026
@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @moderation

🐱

Caused by: #47314 was opened by phlax.

see: more, trace.

@phlax

phlax commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

requires #47310

@phlax

phlax commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

this one cant pass until it lands as it requires var/s set in ci

@phlax phlax changed the title [WIP] ci/distribution: Switch to hermetic pgp signing tool (sq) ci/distribution: Switch to hermetic pgp signing tool (sq) Sep 9, 2026
@phlax
phlax marked this pull request as ready for review September 9, 2026 11:42
@phlax phlax changed the title ci/distribution: Switch to hermetic pgp signing tool (sq) [WIP] ci/distribution: Switch to hermetic pgp signing tool (sq) Sep 9, 2026
@phlax
phlax marked this pull request as draft September 9, 2026 12:13
@phlax phlax changed the title [WIP] ci/distribution: Switch to hermetic pgp signing tool (sq) ci/distribution: Switch to hermetic pgp signing tool (sq) Sep 10, 2026
@phlax
phlax marked this pull request as ready for review September 10, 2026 15:13

@jwendell jwendell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup - the string_flag + no-remote layering plus the aquery audit step is a much more robust story than the old MOUNT_GPG_HOME approach. I couldn't find a path for key material to reach the build graph or caches.

Two things I think are release-breaking though (both are about where artifacts land in the bundle vs. what the unchanged downstream consumers look for), plus a small consistency nit. Details inline.

Review assisted by GitHub Copilot.

Comment thread distribution/BUILD Outdated
Comment on lines +265 to +266
cp $(location :signed_checksums) "$$tmpdir/checksums.txt.asc"
cp $(location :signed_checksums_checksums) "$$tmpdir/checksums.txt"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checksums.txt.asc will no longer be published as a release asset.

These put the checksums at the root of the bundle, but the old envoy.gpg.sign tool wrote checksums.txt.asc inside bin/ (BinarySigningUtil.checksum_path = self.path / "checksums.txt.asc", where self.path is the bin dir).

The publisher is unchanged by this PR and is a pinned pip package: envoy.base.utils project.publish() does

with utils.untar(assets) as tmpdir:
    release.assets.push(tmpdir.joinpath("bin"))

and aio.api.github's push() uploads path.glob("*") - bin/ only, non-recursive.

The v1.39.1 release asset list is exactly the old bin/ contents:

checksums.txt.asc, debs.tar.gz,
envoy-1.39.1-linux-{aarch_64,x86_64},
envoy-contrib-1.39.1-linux-{aarch_64,x86_64}

So as written the release would ship 5 assets and lose the only signature artifact consumers verify against. The same applies to the new changes/<arch>/*.changes written at the bundle root just below - they'd never be uploaded either.

Suggest placing checksums.txt/checksums.txt.asc under bin/ (matching the old layout), or changing the publish path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eek - we defo need this not to break

Comment thread distribution/packages.bzl
srcs = [":distro_packages"],
tools = ["//tools/distribution:sign"],
tags = ["no-remote"],
extension = "tar.gz",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed per-distro .changes dropped from debs.tar.gz - distro verify will silently test nothing.

With packages.<arch>.tar.gz now a plain pkg_tar, debs.tar.gz contains only the original unsigned multi-distro <pkg>_<ver>_<arch>.changes. Previously //tools/distribution:sign ran at per-arch packaging time and replaced those with one debsigned file per distro (envoy_1.39.1_amd64.bookworm.changes, ...), which flowed into bin/debs.tar.gz. The new signed copies land at changes/<arch>/<pkg>.<distro>.changes with different names.

.github/workflows/_publish_verify.yml and distribution/distros.yaml aren't touched in this PR. The verify job still builds its test tree solely from bin/debs.tar.gz (untars it and copies *_${DEB_ARCH}* into distribution/deb), and envoy.distribution.verify selects installables via

packages_dir.joinpath(type).glob(f"*.{ext}")

with ext = bookworm.changes / trixie.changes / focal.changes / jammy.changes / noble.changes from distros.yaml (distrotest.py:229-231, checker.py:129-136).

None of those globs can match any more, so check_distros iterates an empty package list - the job likely goes green while verifying nothing.

Either restore the signed per-distro .changes into debs.tar.gz under the historical <pkg>_<version>_<arch>.<distro>.changes names, or update _publish_verify.yml/distros.yaml to consume the new changes/<arch>/ layout.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or this

Comment thread ci/do_ci.sh Outdated
echo "Signing binary packages..."
setup_clang_toolchain
if [[ -z "${ENVOY_SIGNING_KEY_PATH}" || -z "${ENVOY_SIGNING_PASSPHRASE_PATH}" ]]; then
echo "ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: convention in this file is to prefix messages that precede a non-zero exit with FAIL: (see lines 60, 87, 91, 119, 124, 138, 1087, 1093, 1249):

Suggested change
echo "ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2
echo "FAIL: ENVOY_SIGNING_KEY_PATH and ENVOY_SIGNING_PASSPHRASE_PATH must be set" >&2

Worth applying consistently anywhere an error is printed and the script then exits non-zero.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment thread distribution/BUILD Outdated
fi
if [[ -n $$NEEDS_PATH ]]; then
echo "You must set //distribution:x64-release and //distribution:arm64-release for signing packages" >&2
echo "You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same FAIL: nit as in ci/do_ci.sh - this message is also immediately followed by exit 1:

Suggested change
echo "You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2
echo "FAIL: You must set //distribution:x64-release and //distribution:arm64-release for building release binaries" >&2

Signed-off-by: Ryan Northey <[email protected]>
@repokitteh-read-only repokitteh-read-only Bot removed the deps Approval required for changes to Envoy's external dependencies label Sep 10, 2026
@phlax
phlax merged commit baf1a09 into envoyproxy:main Sep 10, 2026
25 of 26 checks passed
tomjzzhang pushed a commit to envoyproxy/nighthawk that referenced this pull request Oct 16, 2026
- Update ci/docker-compose.yml to envoyproxy/envoy#47758, envoyproxy/envoy#47932, envoyproxy/envoy#47314
- Update docs/root/updating_envoy_dependency.md to include syncing ci/docker-compose.yml

---------

Signed-off-by: Jason Ye <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants