Repository navigation
skills(install-tend): restructure bot-token step around scope-audit remediation - #680
Merged
Merged
Conversation
…emediation Step 8 is the remediation target that nightly's PAT scope-audit issues link to, but it only described first-time setup. Rework it: - Split into 8a (refresh — bot already in keyring), 8b (login — first-time), 8c (push token to secret), routed by a `gh auth status` keyring check; insecure-storage entries route to 8b. - Lead with the scope-audit arrival case: mint the broader token, update the `secrets.bot_token` secret from `.config/tend.yaml` (default TEND_BOT_TOKEN), close the issue. Audit issues may paraphrase the secret name, so go by the config. - Document GH_TOKEN/GITHUB_TOKEN env precedence once up front and prefix keyring-mutating and identity-read commands with `env -u GH_TOKEN -u GITHUB_TOKEN`; `gh auth token --user` and `gh secret` run bare. - Run the device flow ourselves when shell/keyring access allows (background it, surface the code/URL); hand it to the user only when we can't. Refresh needs no post-hoc identity check — a wrong-user approval errors and discards the credentials. - Parameterize the secret name in 8c and the summary checklist instead of hardcoding TEND_BOT_TOKEN. nightly: the scope-audit issue body must name the secret by its real config name (`secrets.bot_token` value, default TEND_BOT_TOKEN), never a placeholder. Co-Authored-By: Claude Fable 5 <[email protected]>
Review fixes on top of the step-8 redesign: guard the secret push against blanking on a failed keyring read, add a skip route when the stored token already carries all six scopes, document device-code expiry and the delegation credential split, prefix every env-sensitive command, and rebuild the intro as one state-driven flow. Co-Authored-By: Claude Fable 5 <[email protected]>
tend-agent
reviewed
Jun 10, 2026
tend-agent
left a comment
Collaborator
There was a problem hiding this comment.
Verified the gh behavioral claims against cli/cli v2.92.0 — the env-token guard fires for login/refresh/switch/logout, refresh merges existing scopes and rejects mismatched users with "received credentials for …", and gh secret set's getBody blindly takes io.ReadAll(stdin) with no emptiness check. Routing logic and (keyring) source detection match status.go's output format.
One robustness note inline on 8c.
…dent The bare [ -n ] test only halts under set -e; chain with || exit so a failed keyring read short-circuits the secret push in any shell. Co-Authored-By: Claude Fable 5 <[email protected]>
tend-agent
approved these changes
Jun 10, 2026
- chain 8a's switch and refresh with && so a failed switch can't run the device flow against the wrong account - replace the unactionable "switch away afterwards" advice in 8c's skip branch (the bot is the sole keyring account there) with why bot-stays-active is harmless under an env-token maintainer - condition the Browser sessions claim on step 8's mint paths - scope-merge claim now scoped to still-valid stored tokens - delegation trigger is now testable (delegate only if running it yourself fails) and hands over fully substituted commands - restore the canonical-repo caveat on the inline $REPO derivation - pat-scope-audit.sh sync note covers multiple occurrences per file Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Jun 10, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
Jun 11, 2026
Bumps the generator version to 0.1.4, syncs the lockfile, and adds the 0.1.4 CHANGELOG section (published as the GitHub Release notes on tag push). Notable changes since 0.1.3: - Claude harnesses switch to `bypassPermissions` (#677) - GitHub Releases publish from `CHANGELOG.md` on tag push (#678) — this release is the first live exercise of that workflow - Interactive sandbox receives GitHub Actions context env vars (#664) - install-tend bot-token step restructured around scope-audit remediation (#680) - Review skill checks the rollup before APPROVE (#667); running-in-ci/triage/ci-fix skill refinements (#661, #666, #669, #670, #671) > _This was written by Claude Code on behalf of max_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
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.
Step 8 of the install-tend skill previously had a single path: a full
gh auth logindevice flow, written for first-time setup and run by the user. This PR restructures it around what the step actually does (check what gh already stores for the bot, mint a token only if needed, push it to the repo secret) so one procedure serves both fresh installs and theBot PATscope-audit remediation that nightly audit issues link to.What changed:
gh auth refresh" (new 8a: preserves existing scopes and hard-fails if the wrong browser account approves, so no post-hoc identity check is needed), or "absent,gh auth login" (8b, the old path with its verify step).GH_TOKEN/GITHUB_TOKENprecedence breaks carry theenv -uprefix (login/refresh/switch/logout andgh api user); env-indifferent commands run bare.gh auth token | gh secret setpipe could silently blank a working secret.gh secret setaccepts an empty body (cli/cliset.goreads stdin with a bareio.ReadAll) and the pipe's exit status hides the failed read, while the step's freshness check still passes. Now: capture, emptiness guard,--body.gh auth token --userreads must run in that same terminal). Device-code expiry (~15 minutes) documented.secrets.bot_token, defaultTEND_BOT_TOKEN) rather than improvising a placeholder. A real audit issue inventedBOT_GITHUB_TOKEN, which cost remediation time before the real secret name was identified.The gh behavioral claims were verified against cli/cli source: the env-token guard shared by login/refresh/switch/logout, refresh's wrong-approver rejection and scope merging, the
(keyring)suffix ingh auth statusoutput,TokenForUserignoring env vars, andgh secret setaccepting an empty body.Supersedes the unmerged
install-tend-refresh-shortcutbranch (093000b), whose refresh-path change is incorporated here.🤖 Generated with Claude Code