🐛 ci: unblock tflint plugin install after GitHub attestation API change - #3076
Merged
Conversation
`tflint --init` has been crashing on every PR that touches content/, blocking
the validate-terraform job repo-wide. The cause is external: GitHub removed the
`bundle` property from attestation list responses, and the removal reached the
2022-11-28 API version that tflint pins. The endpoint now returns `bundle: null`
alongside a new `bundle_url`. Go unmarshals the null into a nil *bundle.Bundle
without error, and tflint passes it straight to the verifier, which dereferences
it:
sigstore-go/pkg/bundle.(*Bundle).TlogEntries <- nil deref
tflint/plugin.(*SignatureChecker).VerifyAttestations
tflint/plugin.(*InstallConfig).Install
The panic happens while downloading the ruleset plugin, before tflint reads a
line of HCL, so no policy content is at fault. Upstream: tflint#2591, fix in
tflint#2593 (unreleased).
Set `signature = "pgp"` on each ruleset plugin block, which still verifies the
plugin cryptographically via the legacy signing key. It is deliberately not
`signature = "none"`, which would skip verification entirely. The attribute
needs tflint >= 0.62 (v0.61.0 silently ignores it, including bogus values), so
the pin also moves to v0.63.1 — a normal upgrade we want regardless, not part
of the temporary workaround.
Verified locally against tflint v0.63.1: all 1172 terraform remediation blocks
across every target pass with exit 0, matching the pre-break baseline. The
bundled terraform ruleset moving 0.14.1 -> 0.15.0 surfaced no new findings.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Every PR touching
content/is currently blocked — thevalidate-terraformjob fails before it lints a single line of HCL. Example: run on #3074.The cause is outside this repo. GitHub removed the
bundleproperty from attestation list responses, and the removal reached the2022-11-28API version that tflint pins (documented breaking change). The endpoint now returns"bundle": nullalongside a newbundle_url. Go'sjson.Unmarshalputs thenullinto a*bundle.Bundleas a nil pointer without erroring, andVerifyAttestationshands that nil straight to the verifier:The crash happens while downloading the ruleset plugin, so no policy content is at fault. tflint's own CI is broken by this too. Upstream issue: terraform-linters/tflint#2591; fix in #2593, unreleased.
The CI log said
tflint plugin init failed for required providers, which is our validator's own message —init_tflint()only checks the exit code and discards stderr, so the actual panic never surfaced. The staleGITHUB_TOKENrate-limit comment in the workflow points the same wrong direction.Fix
Set
signature = "pgp"on each ruleset plugin block. This still verifies the plugin cryptographically via the legacy signing key — it is deliberately notsignature = "none", which would skip verification entirely.The attribute needs tflint >= 0.62, so the pin moves
v0.61.0→v0.63.1. Worth being explicit about the two halves:signature = "pgp"is temporary and carries a dated comment pointing at 📝 Add Ansible remediation steps to the AI security policy #2593. Revert it once the upstream fix ships — attestations verify provenance, PGP only verifies signing.Verification
Ran the full validator locally against tflint v0.63.1 from a cold plugin cache:
0.14.1→0.15.0surfaced no new findings.This PR touches
content/, sovalidate-terraformruns against itself here — a green check is the real proof.Alternatives ruled out
GITHUB_TOKEN— still panics; the issue's "works without a token" claim did not reproduce.signature = "pgp"on v0.61.0 — silently ignored. v0.61.0 doesn't error on a bogussignaturevalue either, which is how I confirmed the attribute doesn't exist there.Follow-up
Installing plugins directly from pinned release URLs with checksum verification would make this immune to the attestation API entirely (and to API rate limits), but it trades provenance verification for integrity-only. Not worth it as an emergency fix while #2593 is in flight; happy to open it separately if we keep getting burned.
🤖 Generated with Claude Code