@@ -117,10 +117,52 @@ jobs:
117117 with :
118118 fetch-tags : true
119119 fetch-depth : 0
120- - uses : ./.github/actions/setup_build_env
120+
121+ # Install sfw BEFORE any dependency installation so all packages are scanned.
122+ - name : Install Socket.dev Firewall (free)
123+ uses : SocketDev/action@2d3f25590c6ed6ba11a9a14c064d962a3a04698f # v1.3.1
124+ with :
125+ mode : firewall-free
126+
127+ - name : Install Bun
128+ uses : oven-sh/setup-bun@v2
129+ - name : Activate sfw shims for npm and bun
130+ run : |
131+ SHIM_DIR="$(cd scripts/sfw-shims && pwd)"
132+ echo "$SHIM_DIR" >> "$GITHUB_PATH"
133+ echo "REFLEX_USE_SYSTEM_BUN=1" >> "$GITHUB_ENV"
134+
135+ # Inline setup_build_env steps so all installs go through sfw.
136+ - name : Install UV
137+ uses : astral-sh/setup-uv@v6
121138 with :
122139 python-version : ${{ matrix.python-version }}
123- run-uv-sync : true
140+ enable-cache : true
141+ prune-cache : false
142+ activate-environment : true
143+ cache-dependency-glob : " uv.lock"
144+ - name : Setup Node
145+ uses : actions/setup-node@v4
146+ with :
147+ node-version : 22
148+
149+ # Build git+https deps as wheels outside sfw (avoids sfw MITM cert issues
150+ # with git), then install everything else through sfw for scanning.
151+ # TODO: revisit when https://github.com/SocketDev/sfw-free/issues/30 is resolved.
152+ - name : Pre-install git dependencies (outside sfw)
153+ run : |
154+ # Install git+https deps directly without sfw to avoid MITM cert issues.
155+ # Their transitive registry deps will still be scanned by sfw uv sync.
156+ grep -oP 'git\+https://[^"]+' uv.lock | sort -u > "$RUNNER_TEMP/git-deps.txt" || true
157+ if [ -s "$RUNNER_TEMP/git-deps.txt" ]; then
158+ echo "Installing git dependencies:"
159+ cat "$RUNNER_TEMP/git-deps.txt"
160+ uv pip install --no-deps -r "$RUNNER_TEMP/git-deps.txt"
161+ else
162+ echo "No git dependencies found."
163+ fi
164+ - name : Install Dependencies (scanned by Socket.dev)
165+ run : sfw uv sync
124166
125167 - name : Clone Reflex Website Repo
126168 uses : actions/checkout@v4
@@ -130,25 +172,45 @@ jobs:
130172 path : reflex-web
131173 submodules : recursive
132174
133- - name : Compile pyproject.toml into requirements.txt
175+ # TODO: revisit when https://github.com/SocketDev/sfw-free/issues/30 is resolved.
176+ - name : Pre-install reflex-web git dependencies (outside sfw)
134177 working-directory : ./reflex-web
135178 run : |
136- uv pip compile pyproject.toml --no-annotate --no-header --no-deps --output-file requirements.txt
179+ # Install git+https deps from pyproject.toml before pip compile resolves them.
180+ # Exclude reflex itself — the PR version is already installed.
181+ grep -oP 'git\+https://[^"'"'"']+' pyproject.toml | grep -v 'reflex-dev/reflex\.git' | sort -u > git-requirements.txt || true
182+ if [ -s git-requirements.txt ]; then
183+ echo "Installing git dependencies:"
184+ cat git-requirements.txt
185+ uv pip install --no-deps -r git-requirements.txt
186+ fi
187+ - name : Compile and install reflex-web requirements (scanned by Socket.dev)
188+ working-directory : ./reflex-web
189+ run : |
190+ sfw uv pip compile pyproject.toml --no-annotate --no-header --no-deps --output-file requirements.txt
137191 uv pip list --format=json | jq -r '"^" + .[].name + "[ =]"' > installed_patterns.txt
138192 grep -ivf installed_patterns.txt requirements.txt > requirements.txt.tmp && mv requirements.txt.tmp requirements.txt
139193 rm installed_patterns.txt
140- - name : Install Requirements for reflex-web
141- working-directory : ./reflex-web
142- run : uv pip install -r requirements.txt
194+ if [ -s requirements.txt ]; then
195+ sfw uv pip install -r requirements.txt
196+ fi
143197 - name : Init Website for reflex-web
144198 working-directory : ./reflex-web
145199 run : uv run --active --no-sync reflex init
146200 - name : Run Website and Check for errors
147201 run : |
148- # Check that npm is home
149- npm -v
202+ # Verify sfw wrappers are on PATH
203+ which npm && npm -v
150204 uv run --active --no-sync bash scripts/integration.sh ./reflex-web prod
151205
206+ - name : Upload Socket.dev Firewall report
207+ if : always()
208+ uses : actions/upload-artifact@v4
209+ with :
210+ name : sfw-report-reflex-web-py${{ matrix.python-version }}
211+ path : ${{ env.SFW_JSON_REPORT_PATH }}
212+ if-no-files-found : warn
213+
152214 rx-shout-from-template :
153215 strategy :
154216 fail-fast : false
0 commit comments