Skip to content

Commit ff3ea84

Browse files
authored
ci: route publish and Socket CLI installs through Socket Firewall (#15)
* ci: route publish and Socket CLI installs through Socket Firewall Wrap public npm-compatible dependency downloads in the release publisher and the nightly Socket CLI job with the pinned workos/setup-socket-firewall action, then tear it down to restore public registry access before build, credentials, and publication. - release.yml: configure firewall after registry-mutating setup-node, keep it active across `pnpm install`, and tear down before build/publish. Declare the named public firewall secret on workflow_call. - release-please.yml: pass PUBLIC_SOCKET_FIREWALL_TOKEN explicitly to the reusable publisher (no secrets: inherit). - socket-tier1-analysis.yml: firewall the scheduled `npm install -g socket` with its own setup/teardown pair. * ci: cover contribution installs with Socket Firewall --------- Co-authored-by: Matt Peake <peakematt@users.noreply.github.com>
1 parent 194c237 commit ff3ea84

4 files changed

Lines changed: 63 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- 'main'
77
pull_request: {}
88

9+
permissions:
10+
contents: read
11+
912
defaults:
1013
run:
1114
shell: bash
@@ -16,6 +19,15 @@ jobs:
1619
runs-on: ubuntu-latest
1720
steps:
1821
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
22+
with:
23+
persist-credentials: false
24+
25+
- name: Configure Socket Firewall
26+
uses: workos/setup-socket-firewall@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
27+
with:
28+
token: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
29+
allow-external-fork-fallback: true
30+
1931
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
2032
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2133
with:
@@ -73,6 +85,15 @@ jobs:
7385
runs-on: ubuntu-latest
7486
steps:
7587
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
88+
with:
89+
persist-credentials: false
90+
91+
- name: Configure Socket Firewall
92+
uses: workos/setup-socket-firewall@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
93+
with:
94+
token: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
95+
allow-external-fork-fallback: true
96+
7697
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
7798
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
7899
with:

‎.github/workflows/release-please.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ jobs:
3131
needs: release-please
3232
if: ${{ needs.release-please.outputs.release_created == 'true' }}
3333
uses: ./.github/workflows/release.yml
34+
# Pass the named public Socket Firewall secret explicitly. Never use
35+
# secrets: inherit for a reusable workflow.
36+
secrets:
37+
PUBLIC_SOCKET_FIREWALL_TOKEN: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}

‎.github/workflows/release.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Release
33
on:
44
workflow_dispatch:
55
workflow_call:
6+
secrets:
7+
PUBLIC_SOCKET_FIREWALL_TOKEN:
8+
description: >-
9+
Socket Firewall auth token for public npm-compatible dependency
10+
downloads. Callers must pass this secret explicitly; never inherit.
11+
required: true
612

713
defaults:
814
run:
@@ -17,16 +23,39 @@ jobs:
1723
id-token: write
1824
steps:
1925
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
26+
27+
# Activate Socket Firewall before the pnpm manager action so that
28+
# bootstrap is covered too. setup-node below writes registry config for
29+
# npm publishing, so the firewall is configured again after setup-node.
30+
- name: Configure Socket Firewall for pnpm manager
31+
uses: workos/setup-socket-firewall@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
32+
with:
33+
token: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
34+
2035
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6
2136
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
2237
with:
2338
node-version: 24
2439
registry-url: 'https://registry.npmjs.org'
2540
cache: 'pnpm'
2641

42+
# Re-apply after the registry-mutating setup-node above and before the
43+
# workspace dependency install. This keeps the firewall active through
44+
# `pnpm install` while preserving setup-node's publish auth placeholder.
45+
- name: Configure Socket Firewall for workspace install
46+
uses: workos/setup-socket-firewall@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
47+
with:
48+
token: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
49+
2750
- name: Install Dependencies
2851
run: pnpm install
2952

53+
# Remove only SFW-owned npm/DNS configuration and restore public registry
54+
# access before build, credentials, and publication. No dependency
55+
# download occurs after this step (`pnpm run build` is offline tsc).
56+
- name: Restore public package registry
57+
uses: workos/setup-socket-firewall/teardown@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
58+
3059
- name: Build project
3160
run: pnpm run build
3261

‎.github/workflows/socket-tier1-analysis.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,19 @@ jobs:
3232
echo "distinct_id: $DISTINCT_ID"
3333
- name: Checkout code
3434
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
35+
# Route the Socket CLI global install through the WorkOS Socket Firewall.
36+
- name: Configure Socket Firewall
37+
uses: workos/setup-socket-firewall@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
38+
with:
39+
token: ${{ secrets.PUBLIC_SOCKET_FIREWALL_TOKEN }}
3540
- name: Install Socket CLI
3641
# Pinned so a compromised release can't run arbitrary code next to
3742
# SOCKET_SECURITY_API_TOKEN; bump deliberately.
3843
run: npm install -g socket@1.1.145
44+
# Restore public registry access before the scan runs; no dependency
45+
# download occurs after this step.
46+
- name: Restore public package registry
47+
uses: workos/setup-socket-firewall/teardown@ca93dd8aa351f54f4729fe3377a9be23c631c25d # v1
3948
- name: Run Tier 1 reachability scan
4049
env:
4150
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_API_KEY }}

0 commit comments

Comments
 (0)