Skip to content

feat: warn on vulnerable torch versions in fal run#962

Open
wennergr wants to merge 2 commits into
mainfrom
feat/torch-vulnerability-warning
Open

feat: warn on vulnerable torch versions in fal run#962
wennergr wants to merge 2 commits into
mainfrom
feat/torch-vulnerability-warning

Conversation

@wennergr

@wennergr wennergr commented Apr 7, 2026

Copy link
Copy Markdown

Adds a security warning in fal run when the app's requirements include a torch version <= 2.5, which has known serialization vulnerabilities allowing malicious model files to execute arbitrary code.

The warning also notes that a future release will automatically set weights_only=True on torch.load() calls for torch < 2.6 as a mitigation.

Adds a security warning in `fal run` when the app's requirements
include a torch version <= 2.5, which has known serialization
vulnerabilities allowing malicious model files to execute arbitrary code.

The warning also notes that a future release will automatically set
weights_only=True on torch.load() calls for torch < 2.6 as a mitigation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@wennergr wennergr requested review from badayvedat and efiop April 7, 2026 21:36
@wennergr

wennergr commented Apr 7, 2026

Copy link
Copy Markdown
Author

Not convinced that this is the right place to put this warning (fal run)

╭─────────────────────────────── Security Warning ───────────────────────────────╮
│                                                                                │
│  Versions 2.5 and earlier of pytorch have a known serialization vulnerability  │
│  that may allow malicious model files to execute arbitrary code.               │
│                                                                                │
│  In a future release, fal will automatically set weights_only=True             │
│  on torch.load() calls for torch versions prior to 2.6 as a mitigation,        │
│  but upgrading to torch>=2.6 is strongly recommended.                          │
│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯

Comment on lines +247 to +253
def _is_safe_version(version_str: str) -> bool:
parts = version_str.split(".")
try:
major, minor = int(parts[0]), int(parts[1])
except (IndexError, ValueError):
return False
return major > 2 or (major == 2 and minor >= 6)

@badayvedat badayvedat Apr 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fails on something like this, while it should not

from fal.cli._utils import warn_if_vulnerable_torch

from rich.console import Console
from rich.theme import Theme

console = Console(theme=Theme(), soft_wrap=True)

warn_if_vulnerable_torch(["torch>3"], console=console)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants