Allow user to specify weights_only=True to tighten security#10666
Open
zaz wants to merge 7 commits intopyg-team:masterfrom
Open
Allow user to specify weights_only=True to tighten security#10666zaz wants to merge 7 commits intopyg-team:masterfrom
weights_only=True to tighten security#10666zaz wants to merge 7 commits intopyg-team:masterfrom
Conversation
Add a `weights_only` parameter to `fs.torch_load` so callers can control the security-sensitive fallback behavior: - `weights_only=None` (default): preserve current fallback behavior - `weights_only=True`: strict mode, raise on failure (no fallback) - `weights_only=False`: skip the weights_only=True attempt entirely The default behavior is unchanged, keeping full backward compatibility.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10666 +/- ##
==========================================
- Coverage 86.11% 84.20% -1.91%
==========================================
Files 496 510 +14
Lines 33655 36029 +2374
==========================================
+ Hits 28981 30339 +1358
- Misses 4674 5690 +1016 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Emit a FutureWarning when the weights_only=True attempt fails and torch_load silently falls back to weights_only=False. In a future release this fallback will be removed - callers should pass an explicit weights_only value.
b899cf5 to
3d262f3
Compare
This was referenced Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10665.
The first two commits allow users of the function to pass
weights_only=True, but has no existing changes other than a security clarification in an error message.The second two commits add a deprecation warning and a test. The idea behind this is that we would eventually follow upstream's convention of preventing arbitrary code execution by default, only allowing it if the user explicitly opts in. This addresses the ever-increasing threat of cyber-attacks in this domain. Users may want to use PyG on untrusted or semi-trusted data; prior to this PR, this was totally unsafe.