Skip to content

Commit 6dc2b87

Browse files
committed
ci(release): scope App token to current repo + drop contents:write
1 parent 28d51a5 commit 6dc2b87

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/actions/setup-git-committer/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ runs:
3636
app-id: ${{ inputs['kilo-maintainer-app-id'] }}
3737
private-key: ${{ inputs['kilo-maintainer-app-secret'] }}
3838
owner: ${{ github.repository_owner }}
39+
# Scope the minted installation token to the current repo
40+
# only, even when the kilo-maintainer App is installed on
41+
# multiple repos in the org. Without this, the token would
42+
# carry the App's full installation scope (e.g. both
43+
# shell-security and kilocode) and a compromised workflow
44+
# could push to unrelated repos.
45+
repositories: ${{ github.event.repository.name }}
3946

4047
- name: Configure git user
4148
shell: bash

.github/workflows/publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.channel }}-${{
3434
# id-token:write is required for npm provenance (SLSA attestation).
3535
# This workflow must run on GitHub-hosted runners (not Blacksmith) for
3636
# provenance to work — GitHub's OIDC token is only issued on their infra.
37+
#
38+
# contents: read is sufficient. Post-publish pushes to `main` are
39+
# authenticated by the kilo-maintainer App token (minted by the
40+
# setup-git-committer composite action), not by GITHUB_TOKEN. If a
41+
# future edit accidentally introduces a git/gh call that falls back
42+
# to GITHUB_TOKEN for a write, we want it to fail loudly here rather
43+
# than silently succeed with broader privilege.
3744
permissions:
3845
id-token: write
39-
contents: write
46+
contents: read
4047

4148
jobs:
4249
publish:

0 commit comments

Comments
 (0)