torch.load
with weights_only=True
should not be flagged
#1224
Labels
enhancement
New feature or request
Milestone
Is your feature request related to a problem? Please describe.
Currently bandit reports
B614:pytorch_load_save
for the following code:However, when
weights_only=True
, PyTorch will only deserialize known safe types, so there should be no security issue.Describe the solution you'd like
B614 should only be reported when
weights_only
is missing or set toFalse
.Describe alternatives you've considered
In PyTorch 2.6,
weights_only
is slated to default toTrue
, so once that's out, it may not be necessary to warn whenweights_only
is missing either.Additional context
N/A
Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.
The text was updated successfully, but these errors were encountered: