Skip to content

Commit ba6de6c

Browse files
authored
chore: pin commit SHAs in usage examples, remove floating tag alias workflow (#9)
* chore: pin commit sha in usage examples Signed-off-by: lelia <2418071+lelia@users.noreply.github.com> * chore: add guidance for securely pinning actions with config examples Signed-off-by: lelia <2418071+lelia@users.noreply.github.com> * chore(ci): update release workflow to correlate git tags with commit SHAs Signed-off-by: lelia <2418071+lelia@users.noreply.github.com> * chore(ci): remove support for floating tag aliases Signed-off-by: lelia <2418071+lelia@users.noreply.github.com> --------- Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
1 parent 2d3f255 commit ba6de6c

3 files changed

Lines changed: 102 additions & 52 deletions

File tree

.github/workflows/aliases.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ jobs:
1818
# setup github auth with bot
1919
- name: github auth
2020
id: bot
21-
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42
21+
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
2222
with:
2323
app-id: ${{ secrets.GH_BOT_APP_ID }}
2424
private-key: ${{ secrets.GH_BOT_APP_PEM_FILE }}
2525

2626
- name: checkout
27-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
fetch-depth: 0
3030
persist-credentials: false
3131

3232
- name: setup node
33-
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
33+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
3434
with:
3535
node-version-file: package.json
3636
cache: npm

README.md

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ This action can run in multiple modes:
1313
- [Socket Firewall: Enterprise](#socket-firewall-enterprise)
1414
- Socket CLI: _Coming soon_
1515

16+
### Why We Recommend Pinning
17+
18+
Socket is a security control, so the action that installs it should be pinned, too. We recommend pinning to an immutable commit SHA for the strongest supply-chain protection. If your organization prefers easier readability, pin to an immutable version tag instead. Either way, Dependabot can keep the reference current while preserving a human review gate.
19+
1620
### Socket Firewall: Free
1721

1822
Downloads and installs [Socket Firewall: Free](https://github.com/SocketDev/sfw-free) edition in your GitHub Action job, making it available to use in subsequent steps.
1923

24+
#### Most secure: pin to a commit SHA
25+
2026
```yaml
2127
on: push
2228

@@ -25,9 +31,9 @@ jobs:
2531
runs-on: ubuntu-latest
2632

2733
steps:
28-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2935

30-
- uses: SocketDev/action@v1
36+
- uses: SocketDev/action@2d3f25590c6ed6ba11a9a14c064d962a3a04698f # v1.3.1
3137
with:
3238
mode: firewall-free
3339

@@ -41,6 +47,49 @@ jobs:
4147
- run: sfw pip install -r requirements.txt
4248
```
4349
50+
#### Slightly less secure: pin to an immutable version tag
51+
52+
```yaml
53+
on: push
54+
55+
jobs:
56+
safe-install:
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
61+
62+
- uses: SocketDev/action@v1.3.1
63+
with:
64+
mode: firewall-free
65+
66+
# javascript / typescript
67+
- run: sfw npm install # or yarn, pnpm
68+
69+
# rust
70+
- run: sfw cargo fetch
71+
72+
# python
73+
- run: sfw pip install -r requirements.txt
74+
```
75+
76+
#### Dependabot config
77+
78+
```yaml
79+
version: 2
80+
updates:
81+
- package-ecosystem: "github-actions"
82+
directory: "/"
83+
schedule:
84+
interval: "weekly"
85+
cooldown:
86+
semver-major-days: 14
87+
semver-minor-days: 7
88+
semver-patch-days: 3
89+
```
90+
91+
Add a cooldown period if you want an extra buffer before newly published action releases are proposed. That gives the ecosystem a little time to surface regressions before Dependabot opens an update PR in your repo.
92+
4493
#### Inputs
4594
4695
| Input | Description | Required | Default |
@@ -61,6 +110,35 @@ jobs:
61110

62111
Downloads and installs [Socket Firewall: Enterprise](https://github.com/SocketDev/firewall-release) edition in your GitHub Action job, making it available to use in subsequent steps as a wrapper.
63112

113+
#### Most secure: pin to a commit SHA
114+
115+
```yaml
116+
on: push
117+
118+
jobs:
119+
safe-install:
120+
runs-on: ubuntu-latest
121+
122+
steps:
123+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
124+
125+
- uses: SocketDev/action@2d3f25590c6ed6ba11a9a14c064d962a3a04698f # v1.3.1
126+
with:
127+
mode: firewall-enterprise
128+
socket-token: ${{ secrets.SOCKET_API_KEY }}
129+
130+
# javascript / typescript
131+
- run: sfw npm install # or yarn, pnpm
132+
133+
# rust
134+
- run: sfw cargo fetch
135+
136+
# python
137+
- run: sfw pip install -r requirements.txt
138+
```
139+
140+
#### Slightly less secure: pin to an immutable version tag
141+
64142
```yaml
65143
on: push
66144
@@ -69,9 +147,9 @@ jobs:
69147
runs-on: ubuntu-latest
70148
71149
steps:
72-
- uses: actions/checkout@v4
150+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
73151
74-
- uses: SocketDev/action@v1
152+
- uses: SocketDev/action@v1.3.1
75153
with:
76154
mode: firewall-enterprise
77155
socket-token: ${{ secrets.SOCKET_API_KEY }}
@@ -86,6 +164,23 @@ jobs:
86164
- run: sfw pip install -r requirements.txt
87165
```
88166

167+
#### Dependabot config
168+
169+
```yaml
170+
version: 2
171+
updates:
172+
- package-ecosystem: "github-actions"
173+
directory: "/"
174+
schedule:
175+
interval: "weekly"
176+
cooldown:
177+
semver-major-days: 14
178+
semver-minor-days: 7
179+
semver-patch-days: 3
180+
```
181+
182+
Add a cooldown period if you want an extra buffer before newly published action releases are proposed. That gives the ecosystem a little time to surface regressions before Dependabot opens an update PR in your repo.
183+
89184
#### Inputs
90185

91186
| Input | Description | Required | Default |

0 commit comments

Comments
 (0)