Skip to content

Commit 352749d

Browse files
frigus02copybara-github
authored andcommitted
Secure GitHub actions
- Pin all actions to a commit - Use `persist-credentials: false` for checkout - Limit workflow/action permissions to the minimum. checkout requires `contents: read` and the rest should not require anything. PiperOrigin-RevId: 937942002
1 parent b7d7690 commit 352749d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
build:
1114
name: build ${{ matrix.binding }}
@@ -15,14 +18,17 @@ jobs:
1518
binding: [pixel_bridge, deflate, saphyr, serde_json, zip]
1619
steps:
1720
- name: Checkout code
18-
uses: actions/checkout@v4
21+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
22+
with:
23+
persist-credentials: false
1924

2025
- name: Set up Rust
21-
uses: actions-rust-lang/setup-rust-toolchain@v1
26+
uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1
2227
with:
2328
# NOTE: b/514328084 - Crubit generates some code that causes unused-imports warnings. By
2429
# default rustflags is "-D warnings" causing the build to fail.
2530
rustflags: ""
31+
2632
- name: Install Protobuf
2733
if: matrix.binding == 'serde_json'
2834
run: sudo apt-get update && sudo apt-get install -y libprotobuf-dev protobuf-compiler

0 commit comments

Comments
 (0)