Repository navigation
Conversation
The workflow hands scripts/sync-skills.sh the org-wide, write-capable ORG_PAT as an exported GH_TOKEN, and the script re-exported it. Every descendant of the sync therefore inherited a credential it does not need: the jq config reads, mktemp, realpath, the mkdir/rsync/printf copy path, and the local git add/diff/checkout/commit against the temporary clone. No leak was observed — the existing credential helper already keeps the value out of URLs, argv, logs, and repository files — but the blast radius of any one of those subprocesses was the whole org. skills_sync_capture_token now moves the token into a private shell variable and unsets it before the first subprocess runs, and skills_sync_authenticated re-supplies it, as a single-command assignment prefix (never argv), to exactly the four calls that authenticate to GitHub: the clone, the push, and the two gh pull-request calls. Regression coverage records only "present" or "absent" per subprocess, never the token value, so the assertion log cannot itself leak a credential even if the scoping regresses. Co-Authored-By: Claude Opus 5 (1M context) <[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.
Summary
The skills-sync workflow injects the org-wide, write-capable
ORG_PATasGH_TOKENfor the whole./scripts/sync-skills.shstep, and the scriptre-exported it (
export GH_TOKEN). Every descendant of the sync thereforeinherited a credential it does not need: the
jqconfig reads inscripts/sync-skills.sh,mktemp/realpathinscripts/lib/skills-sync-repo.sh, themkdir/rsync/printfcopy path inscripts/lib/skills-sync-containment.sh, and the localgit add/diff/checkout/commitagainst the temporary clone.This is a least-privilege gap, not an observed leak: the credential
helper added in #124 already keeps the value out of remote URLs, argv, logs,
and repository files, and no exfiltration path was found. What changes is
blast radius — a token with Contents and Pull requests read/write across
every configured consumer repo was reachable from every subprocess rather
than only the four that authenticate.
scripts/lib/skills-sync-auth.shgains two functions:skills_sync_capture_tokenmovesGH_TOKENinto a private (neverexported) shell variable and unsets it, before the first subprocess runs.
skills_sync_authenticated <cmd...>re-supplies it as a single-commandGH_TOKEN=... cmdassignment prefix. The prefix is consumed by the shell,so the value enters exactly one child's environment and never argv.
Only four calls are wrapped: the
git clone, thegit push,gh pr list,and
gh pr create.skills_sync_run_repocallsskills_sync_capture_tokenitself, so the containment holds for direct callers of the library too, not
just the
scripts/sync-skills.shentry point.Follows #124 (credential-helper value containment); this is the matching
environment containment. Documented in
docs/design/skills-sync-operations.mdunder "Trigger and authenticationcontract".
Risk tier
Risk tier: 2 — security-sensitive automation script and its credential
handling; no product surface, no new permissions, no workflow change (the
workflow's
env: GH_TOKENmapping andpermissions: {}are unchanged).Docs housekeeping
auth script and both test files it describes)
instead
No new doc was created;
docs/design/skills-sync-operations.mdis a livingdesign doc updated in place, so no
TEMPLATE.mdstart or new index lineapplies. No new significant decision — this implements the least-privilege
posture ADR-0026's operations already assume.
Verification
Run in a clean worktree off
origin/mainat44dfd0b.make verifygreen —check:docs(59 docs, 469 links, 10 symlinks,all 1.000),
check:organization,check:scripts(
ok bash_syntax: 6/6), andnode --test test/*.test.mjs:62 tests, 62 pass, 0 fail.
git status --porcelainempty aftermake verify..github/workflows/sync-skills.ymlis untouched..agents/skills/frostyard-docs-site/scaffold/nottouched.
Tests run for this change specifically
node --test test/sync-skills-run-repo.test.mjs test/sync-skills.test.mjs test/sync-skills-auth.test.mjs test/sync-skills-containment.test.mjs— allpass.
New: "supplies GH_TOKEN only to the subprocesses that authenticate to
GitHub" (
test/sync-skills-run-repo.test.mjs). Hermetic — a stubbedgit,gh,rsync, andrealpathonPATH, a fake token, no network. Eachstub records only the string
presentorabsentfor its own environment,never the token value, so the assertion log cannot leak a credential even if
the scoping regresses. It asserts the token-bearing set is exactly
git clone,git push,gh pr list,gh pr create, and asserts positivelythat
git add,git diff,git checkout,git commit,rsync, andrealpatheach ran with it absent.Mutation-checked: reverting
skills_sync_capture_token'sunset GH_TOKENtoexport GH_TOKEN(the pre-change behavior) fails the new test with all tenof those subprocesses reported
present; restoring it passes.Unchanged and still green, proving the value containment from #124 survives:
skills_sync_credential_helper is a template, never the literal token value,skills_sync_credential_helper authenticates git from the environment, not an argument,removes the clone directory and never leaks the token on a successful sync(asserts the fake token appears nowhere in the command log),and the clone-fail / push-fail / unknown-skill / containment-escape cases.