Skip to content

Use hermetic jq toolchain for PGP audit rules - #1129

Draft
phlax with Copilot wants to merge 3 commits into
bazel-gpgfrom
copilot/bazel-gpg-another-one
Draft

Use hermetic jq toolchain for PGP audit rules#1129
phlax with Copilot wants to merge 3 commits into
bazel-gpgfrom
copilot/bazel-gpg-another-one

Conversation

Copilot AI commented Sep 6, 2026

Copy link
Copy Markdown

The PGP audit was implemented as shell scripts that could run host jq, making the security audit itself non-hermetic. This moves audit evaluation into Bazel/Starlark-backed jq actions using the resolved aspect_bazel_lib jq toolchain.

  • Hermetic audit rules

    • Added //pgp/audit:defs.bzl with pgp_audit, pgp_audit_test, and runnable //pgp/audit:audit.
    • Audit reports are generated as cacheable Bazel actions from captured aquery JSON.
    • The runnable audit launcher resolves jq from runfiles, never $PATH.
  • jq filter-based audit logic

    • Added pgp/audit/lib.jq and pgp/audit/audit.jq.
    • Audit output is structured JSON:
      {
        "actions": 4,
        "failures": []
      }
  • Fixture generation without shell jq

    • Replaced shell-generated broken audit fixtures with Bazel jq() targets.
    • Added breaker filters for missing exec requirements, env leaks, passphrase argv leaks, and key-material inputs.
  • Live audit cleanup

    • //pgp/test:live_audit now only captures live bazel aquery output, then runs //pgp/audit:audit.
    • Removed JQ_BIN and deleted the old shell audit scripts.
  • Input classification fix

    • Replaced basename-based tool filtering with configuration-based tool artifact detection.
    • Updated the signing analysis test to subtract signer runfiles/executable instead of matching stub_signer by name.

Example usage:

load("@envoy_toolshed//pgp/audit:defs.bzl", "pgp_audit", "pgp_audit_test")

pgp_audit(
    name = "signing_audit_report",
    aquery = ":captured.json",
)

pgp_audit_test(
    name = "signing_audit_test",
    aquery = ":captured.json",
)

phlax and others added 2 commits September 6, 2026 14:06
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 audit scripts to use hermetic jq toolchain Use hermetic jq toolchain for PGP audit rules Sep 6, 2026
Copilot AI requested a review from phlax September 6, 2026 13:21
@phlax
phlax force-pushed the bazel-gpg branch 21 times, most recently from e1f7bad to fcd89b3 Compare September 7, 2026 09:23
@phlax
phlax force-pushed the bazel-gpg branch 18 times, most recently from 1b01322 to 2f2dfe5 Compare September 8, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants