Draft
pgp: convert signing key to host path build setting#1128
Conversation
Signed-off-by: Ryan Northey <ryan@synca.io>
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update pgp_sign to use host path for signing key
pgp: convert signing key to host path build setting
Sep 6, 2026
phlax
force-pushed
the
bazel-gpg
branch
21 times, most recently
from
September 7, 2026 09:10
99a5784 to
e1f7bad
Compare
phlax
force-pushed
the
bazel-gpg
branch
11 times, most recently
from
September 8, 2026 16:44
51d46ed to
a54ecf0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts the OpenPGP signing key in
bazel/pgp/from a Bazel label artifact (key = attr.label(...)) to a host path build setting (//pgp:key_path), aligning it withpassphrase_path. This prevents secret key material from entering the Bazel build graph, being hashed in action keys, or being uploaded to remote caches.Key Changes
Build Settings & Starlark Rules (
bazel/pgp/)//pgp:key_pathstring_flag._host_pathhelper inpgp/private/sign.bzlto parse absolute host paths and optional#sha256=digest fragments forkey_path(failing if a fragment is given onpassphrase_pathto avoid passphrase offline-cracking oracles).keyattribute frompgp_signand public macros (pgp_sign_detached,pgp_sign_cleartext,pgp_sign_checksums,pgp_sign_changes_file), settingOpenPGPSignactioninputsto[src]only.Signer CLI Contract (
signer.sh,stub_signer.sh,toolchain.bzl)--key-sha256parameter tosigner.shto verify key digest against host key file prior to key encryption checks and passphrase handling.--keymust be an absolute host path.Audit Hardening (
audit_test.sh,audit_fixtures_test.sh,live_audit.sh)FORBIDDEN_INPUTSregex to match key-like file artifacts (.asc,.pgp,.gpg,.key,secret).OpenPGPSignaction has strictly one non-tool input artifact (the file being signed).fixtures/audit.json.Tests & Documentation (
sign_test.bzl,signer_test.sh,README.md)example_key.pgpfixture target andkeyattributes acrosspgp/test/BUILD.--key-sha256presence/absence, non-toolinputsset validation, empty key path, relative paths, and digest fragment rules.README.mdsecurity model, "What you still own", rules table, and usage guidance.Usage Example
bazel build //:signed_tarball \ --@envoy_toolshed//pgp:key_path=/run/user/1000/gpg/signing-key.asc#sha256=<hex> \ --@envoy_toolshed//pgp:passphrase_path=/run/user/1000/gpg/passphrase