Skip to content

Commit 4f68ba1

Browse files
committed
Gate enterprise SFW on non-fork PRs
1 parent 64a4d96 commit 4f68ba1

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

.github/workflows/dependency-review.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ name: dependency-review
77
# install smoke jobs for the affected manifests, picking the firewall edition
88
# per PR:
99
#
10-
# - SocketDev org members on an in-repo (non-fork) PR -> Socket Firewall
11-
# ENTERPRISE through the socket-firewall environment and its
12-
# SOCKET_SFW_API_TOKEN secret (authenticated, full org-policy enforcement).
13-
# - Everything else -- Dependabot, forks, outside collaborators, or external
14-
# contributors -> Socket Firewall FREE (anonymous, no API token), which is
15-
# safe in the unprivileged `pull_request` context.
10+
# - Trusted authors: any in-repo (non-fork) PR other than Dependabot's
11+
# (i.e. someone with write access) -> Socket Firewall ENTERPRISE through
12+
# the socket-firewall environment and its SOCKET_SFW_API_TOKEN secret
13+
# (authenticated, full org-policy enforcement).
14+
# - Everyone else: Dependabot and all fork PRs from external contributors ->
15+
# Socket Firewall FREE (anonymous, no API token), which is safe in the
16+
# unprivileged `pull_request` context.
1617
#
1718
# Only Enterprise jobs declare the socket-firewall environment. Free jobs do
1819
# not touch that environment or its token.
@@ -81,18 +82,24 @@ jobs:
8182
8283
- name: Determine Socket Firewall mode
8384
id: mode
85+
# Trusted == any in-repo (non-fork) PR that isn't Dependabot's. Only
86+
# accounts with write access can push a branch to this repo, so a
87+
# non-fork PR already implies a trusted author -- the same boundary
88+
# GitHub uses to decide whether secrets are exposed at all.
89+
#
90+
# NB: author_association is deliberately NOT used to require strict org
91+
# membership. It only reflects PUBLIC org membership, so private members
92+
# (the common case) show up as CONTRIBUTOR and would be misclassified.
93+
# Reliable strict-membership detection would need a read:org token or
94+
# public membership. This step references NO secret regardless -- it
95+
# only decides which smoke job runs.
8496
env:
8597
IS_DEPENDABOT: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
8698
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
8799
AUTHOR_ASSOC: ${{ github.event.pull_request.author_association }}
88100
run: |
89101
mode=firewall-free
90-
# Enterprise only for a SocketDev org member (OWNER/MEMBER) on an
91-
# in-repo PR. Everything else -- Dependabot, forks, outside
92-
# collaborators, and external contributors -- uses the free edition.
93-
if [ "$IS_DEPENDABOT" != "true" ] \
94-
&& [ "$IS_FORK" != "true" ] \
95-
&& printf '%s' "$AUTHOR_ASSOC" | grep -qE '^(OWNER|MEMBER)$'; then
102+
if [ "$IS_DEPENDABOT" != "true" ] && [ "$IS_FORK" != "true" ]; then
96103
mode=firewall-enterprise
97104
fi
98105

0 commit comments

Comments
 (0)