Draft
bazel/pgp: fix review findings (sandboxing, passphrase handling, audit, single-src signing)#1127
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] Fix review findings in bazel/pgp signing rules
bazel/pgp: fix review findings (sandboxing, passphrase handling, audit, single-src signing)
Sep 6, 2026
phlax
force-pushed
the
bazel-gpg
branch
21 times, most recently
from
September 7, 2026 09:03
7863422 to
99a5784
Compare
phlax
force-pushed
the
bazel-gpg
branch
20 times, most recently
from
September 8, 2026 19:34
1b01322 to
2f2dfe5
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.
Review of the hermetic OpenPGP signing rules in
bazel/pgp/surfaced several gaps between the stated security model and the implementation: signing actions ran unsandboxed, the passphrase was copied to a second plaintext file, the audit script's "suspicious input" check was dead code against realaqueryoutput, and several rules/tests relied on genrules or a multi-filesrcscontract that didn't match actual usage.Sandboxing & secrets
local(no-sandbox) fromEXECUTION_REQUIREMENTSinsign.bzl,sign_test.bzl,audit_test.sh, and fixtures — signing actions now stay sandboxed as well as local/uncached.signer.shno longer copies the passphrase to amktempfile; it now passes it tosq --password-filevia process substitution (<(printf %s "$(cat "$PASSPHRASE_FILE")")), so it's never written to disk a second time. Removed the now-unneededtrap/umaskscaffolding.env = {"PATH": "/usr/bin:/bin"}instead of relying onenv = {}and libc's compiled-in default path.Audit script
.artifacts[].execPathfield, only "passing" because a fixture hand-inserted it. Rewrote it injqto reconstruct real paths frompathFragments/parentId, scoped to inputs reachable fromOpenPGPSignactions viainputDepSetIds/depSetOfFiles.//pgp/test:live_audit(bazel run //pgp/test:live_audit), which re-runs the audit against a realbazel aqueryof the example targets instead of captured JSON, wired into CI as a new matrix entry.fixtures/audit.json; the 4 broken variants (dropped execution requirement, leakedHOME, key-material input, passphrase on argv) are now derived from it withjqat test time.Rule/test cleanup
pgp_signtakes a singlesrc = attr.label(allow_single_file = True, mandatory = True)instead ofsrcs+ a runtime "exactly one" check.example_key/example_data/example_changesgenrules with static fixture files, and theextensions_load_checkgenrule/.bzlwith abzl_librarycovering the public/private starlark surface.deb_sign_changes→pgp_sign_changes_filewith a doc/TODO clarifying it only clearsigns the.changes/.dscitself, not a fulldebsign(referenced.dsc/.buildinfore-signing is not implemented).MODULE.bazel.lockwas left untouched — this working copy doesn't have the pre-PR parent commit to diff against, and no unrelated churn was introduced here.