Skip to content

Commit 7340af6

Browse files
committed
don't pass git+https dependencies through sfw
1 parent accd5e1 commit 7340af6

1 file changed

Lines changed: 65 additions & 8 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,8 @@ jobs:
117117
with:
118118
fetch-tags: true
119119
fetch-depth: 0
120-
- uses: ./.github/actions/setup_build_env
121-
with:
122-
python-version: ${{ matrix.python-version }}
123-
run-uv-sync: true
124120

121+
# Install sfw BEFORE any dependency installation so all packages are scanned.
125122
- name: Install Socket.dev Firewall (free)
126123
uses: SocketDev/action@v1.3.1
127124
with:
@@ -134,6 +131,41 @@ jobs:
134131
printf '#!/usr/bin/env bash\nexec sfw bun "$@"\n' > "$RUNNER_TEMP/sfw-wrappers/bun"
135132
chmod +x "$RUNNER_TEMP/sfw-wrappers/npm" "$RUNNER_TEMP/sfw-wrappers/bun"
136133
134+
# Inline setup_build_env steps so all installs go through sfw.
135+
- name: Install UV
136+
uses: astral-sh/setup-uv@v6
137+
with:
138+
python-version: ${{ matrix.python-version }}
139+
enable-cache: true
140+
prune-cache: false
141+
activate-environment: true
142+
cache-dependency-glob: "uv.lock"
143+
- name: Setup Node
144+
uses: actions/setup-node@v4
145+
with:
146+
node-version: 22
147+
148+
# Build git+https deps as wheels outside sfw (avoids sfw MITM cert issues
149+
# with git), then install everything else through sfw for scanning.
150+
- name: Pre-build git dependencies as local wheels
151+
run: |
152+
# Extract git+https lines from uv.lock sources and build them without sfw
153+
grep -oP 'git\+https://[^"]+' uv.lock | sort -u > "$RUNNER_TEMP/git-deps.txt" || true
154+
if [ -s "$RUNNER_TEMP/git-deps.txt" ]; then
155+
echo "Building git dependencies as wheels:"
156+
cat "$RUNNER_TEMP/git-deps.txt"
157+
mkdir -p "$RUNNER_TEMP/git-wheels"
158+
while IFS= read -r dep; do
159+
uv pip wheel "$dep" --no-deps --wheel-dir "$RUNNER_TEMP/git-wheels"
160+
done < "$RUNNER_TEMP/git-deps.txt"
161+
# Install the pre-built wheels (no registry fetch needed)
162+
sfw uv pip install --no-deps "$RUNNER_TEMP/git-wheels"/*.whl
163+
else
164+
echo "No git dependencies found."
165+
fi
166+
- name: Install Dependencies (scanned by Socket.dev)
167+
run: sfw uv sync
168+
137169
- name: Clone Reflex Website Repo
138170
uses: actions/checkout@v4
139171
with:
@@ -142,16 +174,33 @@ jobs:
142174
path: reflex-web
143175
submodules: recursive
144176

145-
- name: Compile pyproject.toml into requirements.txt
177+
- name: Compile and install reflex-web requirements
146178
working-directory: ./reflex-web
147179
run: |
148180
uv pip compile pyproject.toml --no-annotate --no-header --no-deps --output-file requirements.txt
149181
uv pip list --format=json | jq -r '"^" + .[].name + "[ =]"' > installed_patterns.txt
150182
grep -ivf installed_patterns.txt requirements.txt > requirements.txt.tmp && mv requirements.txt.tmp requirements.txt
151183
rm installed_patterns.txt
152-
- name: Install Requirements for reflex-web (scanned by Socket.dev)
153-
working-directory: ./reflex-web
154-
run: sfw uv pip install -r requirements.txt
184+
185+
# Separate git+https deps from registry deps
186+
grep '^git+https://' requirements.txt > git-requirements.txt || true
187+
grep -v '^git+https://' requirements.txt > registry-requirements.txt || true
188+
189+
# Build git deps as local wheels outside sfw
190+
if [ -s git-requirements.txt ]; then
191+
echo "Building git dependencies as wheels:"
192+
cat git-requirements.txt
193+
mkdir -p "$RUNNER_TEMP/reflex-web-git-wheels"
194+
while IFS= read -r dep; do
195+
uv pip wheel "$dep" --no-deps --wheel-dir "$RUNNER_TEMP/reflex-web-git-wheels"
196+
done < git-requirements.txt
197+
sfw uv pip install --no-deps "$RUNNER_TEMP/reflex-web-git-wheels"/*.whl
198+
fi
199+
200+
# Install registry deps through sfw for scanning
201+
if [ -s registry-requirements.txt ]; then
202+
sfw uv pip install -r registry-requirements.txt
203+
fi
155204
- name: Init Website for reflex-web
156205
working-directory: ./reflex-web
157206
run: uv run --active --no-sync reflex init
@@ -163,6 +212,14 @@ jobs:
163212
which npm && npm -v
164213
uv run --active --no-sync bash scripts/integration.sh ./reflex-web prod
165214
215+
- name: Upload Socket.dev Firewall report
216+
if: always()
217+
uses: actions/upload-artifact@v4
218+
with:
219+
name: sfw-report-reflex-web-py${{ matrix.python-version }}
220+
path: ${{ env.SFW_JSON_REPORT_PATH }}
221+
if-no-files-found: warn
222+
166223
rx-shout-from-template:
167224
strategy:
168225
fail-fast: false

0 commit comments

Comments
 (0)