Skip to content

Commit 1007deb

Browse files
krlmlrclaude
andcommitted
ci: Lock down format-suggest egress (audit → block)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8995f5b commit 1007deb

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

.github/workflows/format-suggest.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,35 @@ jobs:
5050
pull-requests: write
5151

5252
steps:
53-
# Defense in depth: monitor outbound network traffic from the runner.
54-
# Switch `egress-policy` to `block` (with an `allowed-endpoints` list) to
55-
# hard-fail on any connection outside the formatter tool downloads; run
56-
# once in `audit` first to capture the exact endpoints to allow.
53+
# Defense in depth: block all outbound network traffic except the
54+
# endpoints the formatters legitimately need. Even if a formatter ever
55+
# mishandled attacker-controlled input, it could not exfiltrate the token
56+
# or fetch a second-stage payload.
57+
#
58+
# The GitHub endpoints below were confirmed from a harden-runner `audit`
59+
# run of this workflow (git checkout, setup-air / reviewdog binary
60+
# downloads, reviewdog posting via the API). The apt.llvm.org / Ubuntu
61+
# archive endpoints are only hit when a package ships a `.clang-format`
62+
# file and the `style` action installs clang-format; they are included so
63+
# C++ consumers of this template are not broken, even though a pure-R
64+
# package never contacts them.
65+
#
66+
# If a run is ever blocked, harden-runner reports the denied endpoint in
67+
# the job's "Harden Runner" step summary (and the StepSecurity insights
68+
# for the run) -- add it here and re-run. See the note in the PR for the
69+
# audit -> block workflow.
5770
- name: Harden runner
58-
uses: step-security/harden-runner@v2
71+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2
5972
with:
60-
egress-policy: audit
73+
egress-policy: block
74+
allowed-endpoints: >
75+
github.com:443
76+
api.github.com:443
77+
release-assets.githubusercontent.com:443
78+
objects.githubusercontent.com:443
79+
codeload.github.com:443
80+
apt.llvm.org:443
81+
azure.archive.ubuntu.com:80
6182
6283
# The untrusted PR code, checked out at the workspace root. It is DATA
6384
# only -- nothing below executes it. `allow-unsafe-pr-checkout` is required
@@ -86,7 +107,7 @@ jobs:
86107
uses: ./ci-base/.github/workflows/style
87108

88109
- name: Suggest
89-
uses: reviewdog/action-suggester@v1
110+
uses: reviewdog/action-suggester@2558ba17e65a9039e73764a73009fc05fef28a46 # v1
90111
with:
91112
level: error
92113
fail_level: error

0 commit comments

Comments
 (0)