Skip to content

fix(check-vulnerabilities): avoid direct-URL requirements crashing safety - #1646

Merged
moe-ad merged 3 commits into
mainfrom
fix/check-vulnerabilities-direct-url-freeze
Nov 3, 2026
Merged

moe-ad merged 3 commits into
mainfrom
fix/check-vulnerabilities-direct-url-freeze

Conversation

@RobPasMue

@RobPasMue RobPasMue commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Problem

check-vulnerabilities fails with:

Unhandled exception happened: Object of type set is not JSON serializable
...
FileNotFoundError: [Errno 2] No such file or directory: 'info_safety.json'

Seen in ansys/ansys-tools-common (e.g. https://github.com/ansys/ansys-tools-common/actions/runs/41602389379).

Root cause

The action force-reinstalls pip from a direct URL in the project venv, so uv pip freeze / pip freeze writes:

pip @ https://files.pythonhosted.org/packages/.../pip-26.2.2-py3-none-any.whl#sha256=...

safety check (3.8.1) crashes with the error above when the requirements file contains a direct-URL line and at least one vulnerability is found. Repositories without findings are unaffected, which is why it only shows up in some repos (ansys-tools-common currently pins urllib3==2.7.0 for dev purposes). Any consumer with its own direct-URL/git dependency would hit the same crash.

Reproduced locally: same requirements with pip @ <url> crashes; with pip==26.2.2 safety reports the findings and writes info_safety.json.

Fix

Save installed packages with pip list --format freeze --exclude-editable (uv and pip backends), which always emits name==version. --exclude-editable drops the project's own -e file://... line, which safety ignored anyway. Poetry branch unchanged.

@RobPasMue
RobPasMue requested a review from a team as a code owner November 3, 2026 09:49
@github-actions github-actions Bot added the fix Pull requests related to resolving problems or errors label Nov 3, 2026
@RobPasMue

Copy link
Copy Markdown
Member Author

The bug itself is not directly on us.. it is more on the safety CLI tool honestly - but this should make things more reliable

@RobPasMue

Copy link
Copy Markdown
Member Author

@moe-ad - consider merging this and patch releasing if possible

@moe-ad
moe-ad merged commit 52d930d into main Nov 3, 2026
91 checks passed
@moe-ad
moe-ad deleted the fix/check-vulnerabilities-direct-url-freeze branch November 3, 2026 10:42
moe-ad pushed a commit that referenced this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests related to resolving problems or errors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants