eric7.Plugins.CheckerPlugins.CodeStyleChecker.Security.Checks.pytorchLoad

Module implementing checks for the use of 'torch.load' and 'torch.save'.

Global Attributes

None

Classes

None

Functions

checkPytorchLoad Function to check for the use of 'torch.load'.
getChecks Public method to get a dictionary with checks handled by this module.


checkPytorchLoad

checkPytorchLoad(reportError, context, _config)

Function to check for the use of 'torch.load'.

Using `torch.load` with untrusted data can lead to arbitrary code execution. The safe alternative is to use `weights_only=True` or the safetensors library.

reportError (func)
function to be used to report errors
context (SecurityContext)
security context object
_config (dict)
dictionary with configuration data (unused)
Up


getChecks

getChecks()

Public method to get a dictionary with checks handled by this module.

Return:
dictionary containing checker lists containing checker function and list of codes
Return Type:
dict
Up