Skip to content

features/terraform: Migrate Cosign to GitHub Artifact Attestations for TFLint verification #1563

@wata727

Description

@wata727

See also terraform-linters/tflint#2405

Cosign signature verification in TFLint is now deprecated. We should use gh attestation verify instead.
The Terraform feature uses Cosign, so you will need to migrate:

# Check that checksums.txt.keyless.sig exists and is not empty
if [ -s checksums.txt.keyless.sig ]; then
# Validate checksums with cosign
curl -sSL -o checksums.txt.pem https://github.com/terraform-linters/tflint/releases/download/v${TFLINT_VERSION}/checksums.txt.pem
ensure_cosign
cosign verify-blob \
--certificate=/tmp/tf-downloads/checksums.txt.pem \
--signature=/tmp/tf-downloads/checksums.txt.keyless.sig \
--certificate-identity-regexp="^https://github.com/terraform-linters/tflint" \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
/tmp/tf-downloads/tflint_checksums.txt

I believe the fix itself is relatively easy, but I'm having trouble figuring out how to install the GitHub CLI.
Should I write my own installation script like Cosign, or is there a better way to reuse features/github-cli?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions