Skip to content

ci(release): validate CARGO_REGISTRY_TOKEN against crates.io in the version-gate probe (security-08 gap) #345

Description

@dean0x

Context: the v0.4.0 tag-push release run 33569514359 (tag v0.4.0 at 6673dc3) passed version-gate, all 7 native builds, both musl link gates, the A3 name gate, and the new CI-history gate, then failed in "Publish to crates.io" at cargo publish -p mds-core with 403 Forbidden: authentication failed. Nothing was published (publish-npm and github-release were skipped), so the run is resumable with gh run rerun 33569514359 --failed after the secret is replaced.

Gap: the security-08 credential probe in version-gate verifies the npm token against the live registry (npm whoami) but only checks CARGO_REGISTRY_TOKEN for non-emptiness, so an expired or revoked crates.io token is discovered only at the first irreversible step. RELEASING.md already documents this asymmetry.

Proposal: in the probe, call curl -fsS -H "Authorization: ${CARGO_REGISTRY_TOKEN}" https://crates.io/api/v1/me and require a 200 with a user.login field (fail closed on anything else; never echo the token or the response body beyond the login). Optionally also assert the token can see the crates it must publish via cargo owner --list mds-core --token ... (read-only). Note the crates.io API requires a User-Agent header (curl sets one); document the rate limit. Mirror the check in RELEASING.md's dry-run paragraph so a dead token fails the pre-tag dry-run, matching the npm behaviour.

Acceptance: a revoked token fails the workflow_dispatch dry-run in version-gate with a clear ::error:: before any build; a valid token prints the crates.io login; RELEASING.md updated; verified by a branch dry-run with a deliberately invalid token (positive control) and with the real token.

Relates to #344, #342, PF-023.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    github_actionsPull requests that update GitHub Actions codetech-debtTechnical debt

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions