You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 25bf0ff
Browse filesBrowse the repository at this point in the historyBrowse files
fix: keep run-script caches from fork PRs of public repos
A trusted run can fill the pre-commit and uv caches with private packages
or clones of private hook repositories, which a fork's script could read.
Skip restoring them for pull requests from forks of a public repository.
Also stop calling the github-token token read-only: the job takes the
caller's permissions, so the caller's grant is the only cap on it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .github/workflows/run-script.yml
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ on:
20
20
default: false
21
21
github-token:
22
22
type: boolean
23
-
description: "Expose the job's read-only GitHub token to the script as GH_TOKEN"
23
+
description: "Expose the job's GitHub token to the script as GH_TOKEN. It carries whatever permissions the caller grants, so grant only what the script needs"
24
24
default: false
25
25
mise-env:
26
26
type: string
@@ -44,6 +44,8 @@ on:
44
44
# contents: read for most callers, plus id-token: write for those passing
45
45
# aws-role. A called workflow cannot be granted more than its caller has, and
46
46
# asking for id-token: write here would fail every caller that doesn't grant it.
47
+
# The caller's grant is therefore the only cap on the token github-token
48
+
# exposes, so callers must grant no more than contents: read (and id-token).
47
49
jobs:
48
50
run:
49
51
runs-on: ubuntu-latest
@@ -91,14 +93,18 @@ jobs:
91
93
minimum_release_age: 7d
92
94
cache: true
93
95
94
-
# Always read the caches, it's safe to do so even on untrusted PRs.
96
+
# Caches are restored on every run except pull requests from forks of a
97
+
# public repository: a trusted run may have filled them with private
98
+
# artifacts (packages from a private registry, clones of private hook
99
+
# repositories), which an outsider's script could read and exfiltrate.
100
+
# Forks of a private repository belong to people who can already read it.
95
101
#
96
102
# Hook environments are built with the toolchains mise installs (Python,
97
103
# Node, ...), so the key covers the mise config and lockfiles and the
98
104
# selected environment as well as the hook pins: a toolchain bump must
99
105
# not restore environments built against the old one.
0 commit comments