fix: keep checksum verification when commitlint is public - #5
Merged
Conversation
The install step set GOPRIVATE unconditionally. That is necessary for a private module — the proxy and checksum database cannot see one — but it also disables checksum-database validation, which Go's own documentation calls out. Once commitlint is public that protection would be forfeited silently, with nothing in the workflow output indicating it. Attempt the ordinary public install first and fall back to the credentialed path only when it fails, scoping GOPRIVATE to that fallback. A public commitlint therefore keeps proxy and checksum verification, and a private one still works. When the public fetch fails and no token was supplied, emit an ::error:: naming the likely cause instead of surfacing git's "terminal prompts disabled", which does not say what to do about it. Verified all three paths: a public module installs via the public path, a private module without a token produces the actionable error, and the credentialed fallback installs commitlint v1.1.2. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSrrciEDBTuFNMtKocScML
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.
Found while auditing both repos for public release. This is the one code change I'd want landed before publishing.
The problem
The install step sets
GOPRIVATEunconditionally. That's necessary for a private module — the proxy and checksum database can't see one — but per Go's own documentation it also disables checksum-database validation:So once
commitlintis public, every user of this action would silently forfeit supply-chain verification they should be getting, with nothing in the workflow output indicating it.The fix
Try the ordinary public install first; fall back to credentials only if it fails, with
GOPRIVATEscoped to that fallback:A public
commitlintkeeps full verification. A private one still works exactly as before.Also replaces git's
terminal prompts disabled— which doesn't say what to do — with an::error::naming the actual cause and the input to set.Verification
All three paths exercised, not just the happy one:
GOPRIVATE::error::naming the cause, exit 1commitlint v1.1.2action.ymlparses,actionlintclean, install script passesbash -n.Public-readiness audit (context)
Scanned both repos' complete history, not just current files: 0 secret-pattern hits across 107 objects, no deleted files hiding in old blobs, 0 internal-infrastructure references, MIT licensed, and neither uses
pull_request_target/workflow_run— so fork PRs never receive secrets.release.ymlholdscontents: writebut only triggers on push tomainand tags, which forks cannot do.Both repos are safe to publish. This PR is the one substantive improvement worth landing first.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VSrrciEDBTuFNMtKocScML