Skip to content

fix: keep checksum verification when commitlint is public - #5

Merged
SafeEval merged 1 commit into
mainfrom
agent/public-ready-install
Jul 30, 2026
Merged

fix: keep checksum verification when commitlint is public#5
SafeEval merged 1 commit into
mainfrom
agent/public-ready-install

Conversation

@SafeEval

Copy link
Copy Markdown
Member

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 GOPRIVATE unconditionally. 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:

GOINSECURE does not disable checksum database validation. GOPRIVATE or GONOSUMDB may be used to achieve that.

So once commitlint is 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 GOPRIVATE scoped to that fallback:

if go install "github.com/DivergentCodes/commitlint@${VERSION}"; then
  exit 0          # public path — proxy + checksum verification intact
fi
# ... otherwise rewrite URLs with the token and retry with GOPRIVATE

A public commitlint keeps 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:

Scenario Result
Public module, no token installs via public path, no GOPRIVATE
Private module, no token ::error:: naming the cause, exit 1
Private module, with credentials falls back and installs commitlint v1.1.2

action.yml parses, actionlint clean, install script passes bash -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.yml holds contents: write but only triggers on push to main and 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

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
@SafeEval
SafeEval marked this pull request as ready for review July 30, 2026 20:20
@SafeEval
SafeEval merged commit c3b24e5 into main Jul 30, 2026
2 checks passed
@SafeEval
SafeEval deleted the agent/public-ready-install branch July 30, 2026 20:21
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.

1 participant