Repository navigation
fix(pr-bot-review): mint the fold push token from a dedicated App - #29
Conversation
The App behind the skill-repo read token holds contents: read only, so the fold push mint failed on every repo. The fold push now uses BOT_REVIEW_CLIENT_ID and BOT_REVIEW_APP_PRIVATE_KEY, an App with contents: write installed on the calling repo. The skill-repo read mint is unchanged.
ken-b4m
left a comment
There was a problem hiding this comment.
PR Review: fix(pr-bot-review): mint the fold push token from a dedicated App
Assessment: APPROVE (posted as a comment, because this is a self-review of my own PR). The credential swap is correct and narrowly scoped. There is one P3, and it is optional.
- P3
.github/workflows/pr-bot-review.yml:1116: the mint-failure comment says "the App most likely lackscontents: write". After this PR, the likelier cause is a caller missingBOT_REVIEW_CLIENT_ID/BOT_REVIEW_APP_PRIVATE_KEY, or the new App not being installed on the repo. Name the var, the secret and the App install in that text.:1085has the same unnamed "The App installation" wording. Disposition: fold in if you push again, but it does not justify a push on its own.
CI: 5/5 checks pass at faf6398. Mergeable: yes, 0 behind main, one commit.
Findings in full
P3 - .github/workflows/pr-bot-review.yml:1116 - mint-failure text points at the wrong cause
Report fold failure (:1103-1105) fires when push_token.outcome != 'success' and posts a PR comment. The comment's failure branch blames a missing contents: write scope, and it never says which App. Suppose a caller bumps its pin before provisioning the new credentials. That operator is sent to check scopes on an App, and PREMIUM_OVERLAY is the one they already know. Nothing breaks. Only the diagnosis is pointed the wrong way.
Verified and clean
- Nothing downstream depends on the old App's identity. The caller stub triggers on
types: [labeled]only (README.md:20), so thesynchronizefrom a fold push never starts this workflow. The workflow has nogithub.actor,triggering_actororevent.sendercheck (grep empty). The commit author is hardcoded toclaude[bot]at:1057-1058. Residual risk I cannot see from here: a caller repo whose ruleset bypass list or CI actor filter names the old App. - A missing credential breaks fold runs only. The mint is gated on
env.FOLD_MODE == 'true'plus a posted review (:783-785). The push is gated on the mint's success (:805). Non-fold runs never read the new inputs, and the skill-repo read at:327keeps PREMIUM_OVERLAY. - There is no new secret exposure.
PUSH_TOKENis still confined to thefold_pushenv (:807). The private key goes only tocreate-github-app-token. The mint still narrows topermission-contents: writeon this one repository, so the App's broader issues and PR write is not reachable through this token. - The org holds
BOT_REVIEW_CLIENT_IDandBOT_REVIEW_APP_PRIVATE_KEY, both with visibilityALL. That matches the PR body's claim. Whether the App is installed on each caller repo I did not check.
Method
This review is not independent: I authored the PR. I ran one Security lens (opus), because the diff changes which credential mints a write token. I skipped the DevOps/SRE lens, and I answered its questions inline (secret provisioning, gating, failure surfacing). I re-derived every cited line against faf6398.
The mint-failure comment now names the var, the secret and the App install. Both mint steps' credentials are pinned by value. The README says the App must be installed on the calling repo.
The fold push token was minted from the same App as the skill-repo read token. That App holds
contents: readonly, so the mint failed with "The level of access for permissions requested are not granted to this installation". Fold runs never pushed.The fold push mint now uses a dedicated App, through
vars.BOT_REVIEW_CLIENT_IDandsecrets.BOT_REVIEW_APP_PRIVATE_KEY. That App has contents, issues and pull requests write, no workflows scope, and is installed on the calling repo only. The skill-repo read mint keeps its existing credentials. The README'ssecrets: inheritline names both pairs.A caller must be able to see both new org credentials. Both are visible to bike4mind today.
checkBotFoldWritePath.test.mjspasses 33/33. The step's input key set is unchanged, so the existing pin still holds. The fold canary in bike4mind verifies the push end to end after a pin bump.