In version 0.1.4 of Resemblyzer, the use of torch.load() without explicitly setting weights_only=True can expose users to potential risks when loading pickled files. Pickle files can execute arbitrary code during deserialization, leading to security vulnerabilities, and current versions of torch warn about this.
To address this, I modified Resemblyzer's voice_encoder.py to enforce safer loading practices. Specifically, we updated the torch.load() calls to include the parameter weights_only=True, ensuring that only model weights are loaded without executing untrusted code.
This modification secures the file loading process and mitigates the risks associated with untrusted data deserialization. The change was made directly in the codebase without using external scripts to patch the system.
Details of the Change:
File:voice_encoder.py
Version: Resemblyzer 0.1.4
Modification: Added weights_only=True to all torch.load() calls that previously lacked this parameter.
FYI: Since the currently implemented torch.load() method is considered unsafe, I've been using an automated code patching script for my whisper-transcriber-telegram-bot when it comes to loading Resemblyzer-related stuff. Should someone need to patch their v0.1.4, the script I made is here. I haven't experienced any bugs or glitches when using the weights_only=True load method in my own application.
Fix Description: Resemblyzer Unsafe Pickle Loading Mitigation
In version 0.1.4 of Resemblyzer, the use of
torch.load()
without explicitly settingweights_only=True
can expose users to potential risks when loading pickled files. Pickle files can execute arbitrary code during deserialization, leading to security vulnerabilities, and current versions oftorch
warn about this.To address this, I modified Resemblyzer's
voice_encoder.py
to enforce safer loading practices. Specifically, we updated thetorch.load()
calls to include the parameterweights_only=True
, ensuring that only model weights are loaded without executing untrusted code.This modification secures the file loading process and mitigates the risks associated with untrusted data deserialization. The change was made directly in the codebase without using external scripts to patch the system.
Details of the Change:
voice_encoder.py
weights_only=True
to alltorch.load()
calls that previously lacked this parameter.FYI: Since the currently implemented
torch.load()
method is considered unsafe, I've been using an automated code patching script for my whisper-transcriber-telegram-bot when it comes to loading Resemblyzer-related stuff. Should someone need to patch their v0.1.4, the script I made is here. I haven't experienced any bugs or glitches when using theweights_only=True
load method in my own application.