Repository navigation
Keep builds out of the CI deploy job, keep its token out of the checkout, and pin the CLI - #731
Merged
Merged
Conversation
Path B built, tested and published in the job that holds id-token: write, so a compromised dependency's script could request the job's identity token and trade it for the deploy user's Harper token. It now publishes from a job without id-token, and a needs: deploy job holds the environment and id-token and installs only the Harper CLI. Path A's checkout sets persist-credentials: false, so the job's token stays out of .git/config, and the workflows install harper@^5.3, the first CLI that authenticates with the identity token, instead of an unpinned harper. The reference pages say the deploy job is the one that needs id-token, and to build elsewhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…itory code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-731 This preview will update automatically when you push new commits. |
kriszyp
approved these changes
Oct 14, 2026
🧹 Preview CleanupThe preview deployment for this PR has been removed. |
This branch was previously deployed
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.
⊙ Problem
The CI guide's workflows, which HarperFast/skills#119 quotes word for word, had three gaps:
.git/config.harperunpinned, so rerunning an old tag after a new major release would change the CLI.id-token: write. A compromised dependency could request a token and trade it for the deploy user's Harper token.🤔 Fix the docs rather than the skill?
Yes. The skill rule is generated from this page, so a skill-only fix would be undone by the next sync.
💡 Solution
persist-credentials: false, and every workflow installsharper@^5.3, the first CLI with OIDC.publishbuilds and publishes withoutid-token;deployholds it and installs only the CLI. The page says this narrows the risk but doesn't remove it.🤔 Is losing
ref=<tag>in private repositories acceptable?With the token kept out, the CLI can't look a tag up on GitHub, so the page now says to pass a full commit SHA, or fetch tags with
fetch-depth: 0. The alternative keeps the token in the job for that one lookup.⚖️ Alternatives
harper@5.3.2) — every page and template would need updating per release.^5.3keeps a rerun on 5.x, but each new 5.x installs in the job that can request a token.🤔 Should Path B publish before an approval?
With required reviewers on
production, the package now publishes before anyone approves, since the approval gates onlydeploy. Gatingpublishtoo would need a second approval, or a second environment.🔧 Changes
learn/developers/deploying-from-ci.mdx: Path A's checkout and CLI pin, with a bullet for the checkout and one for the pin; its job runs no repository code; theref=caveat; the wait-loop limit. Path B's two jobs, why, the risk they leave, and the credential and scope notes now namingpublishand no longer the CLI. The preview workflow's CLI pin.reference/cli/authentication.md: why the example job runs no repository code, and where a build belongs.reference/operations-api/operations.md:add_oidc_trust's overview says the deploying job needsid-token: write, and to build elsewhere.✅ Verification
npm run buildpasses with no broken-link or anchor warnings, andnpm run format:checkis clean.publishholdscontents: readandpackages: writeonly, anddeployholdsid-token: writeonly.npm view 'harper@^5.3' versionresolves to 5.3.2.ref=caveat is traced in the CLI: withGITHUB_SHAset,by_ref=trueneeds no git lookup, while a tag missing from the checkout goes togit ls-remote.Related: HarperFast/create-harper#151 (the same fix in the Next.js templates), HarperFast/skills#119 (the rule that quotes this page; its
npm install -g harperanchor is updated to match).🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.
Related PRs: #722 overlaps (merged; added the reference example whose checkout and pin this carries into the guide)
Complexity: medium
Review-Coverage: authored=claude; ran=gemini,codex; adjudicated=domain; blocked=cursor-composer(no-receipt); declined=cursor-grok,cursor-kimi,cursor-muse,muse; rounds=2; full=1 @ c8f6245
Review-Attention: skim ~2m (decisions: caret-range-cli-in-token-job, publish-before-approval, path-a-single-job) @ c8f6245