This is coming out of advice from
https://securityscorecards.dev/viewer/?uri=github.com/carbon-language/carbon-lang

Updates action versions and pins by checksum. This is something we
already do in other places, and doing it with actions just seems
consistent.

Trying to add token permissions at the same time.

step-security/harden-runner is being set up to monitor network traffic
for actions, with the idea that we'd set it to block unexpected traffic
in the future.

Note, https://app.stepsecurity.io/secureworkflow generates the pinned
checksums and adds the harden-runner. In some cases it added token
permissions, but we have a couple it doesn't recognize (`gh` executions,
other custom commands, jlumbroso/free-disk-space, reviewdog/action-setup
as examples) so I'm trying to guess my best.

Because these are workflows, testing is limited.
This commit is contained in:
Jon Ross-Perkins authored and GitHub committed 2024-04-15 14:40:38 +00:00
1 parent 5db71e8fe5
commit 97816a3598
10 files changed
+110 -30

No files matched your search

+10 -4
View File
@@ -19,8 +19,9 @@ on:
types:
- completed
# Note reviewdog/reviewdog has its own token.
permissions:
pull-requests: write
contents: read # For actions/checkout.
jobs:
pull-request-suggestions:
@@ -31,14 +32,19 @@ jobs:
github.actor != 'jonmeow'
runs-on: ubuntu-latest
steps:
- uses: reviewdog/action-setup@v1
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0
with:
reviewdog_version: latest
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Download pre-commit output
uses: actions/download-artifact@v4
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: pre-commit output
github-token: ${{ secrets.GITHUB_TOKEN }}