Vocos создает экземпляр класса, названного в файле конфигурации, не ограничивая, какой класс может быть назван. Instantiate_class в vocos/pretrained.py берет значение class_path из конфигурации, разделяет его на модуль и атрибут, импортирует модуль с помощью __import__, разрешает атрибут с помощью getattr и вызывает результат как args_class(*args, **kwargs), где kwargs — это собственное сопоставление init_args конфигурации. Никакой список разрешений не ограничивает пунктирный путь, поэтому конфигурация может называть любой импортируемый вызываемый объект и предоставлять аргументы, с которыми он вызывается.
Vocos.from_hparams достигает этого для каждой записи Feature_extractor, Backbone и Head, а Vocos.from_pretrained достигает его с помощью удаленного файла: он загружает config.yaml из репозитория Hugging Face с именем вызывающего абонента и передает его прямо в from_hparams. Загрузка модели из репозитория не контролируется пользователем, поэтому в процессе загрузки выполняется код по выбору владельца репозитория. Соседний torch.load загруженных весов является отдельным вопросом и ограничен в выпусках PyTorch, в которых по умолчанию для Weights_only установлено значение true, что оставляет этот путь доступным.
Показать оригинальное описание (EN)
Vocos instantiates a class named by a configuration file without restricting which class may be named. instantiate_class in vocos/pretrained.py takes the class_path value from the configuration, splits it into a module and an attribute, imports the module with __import__, resolves the attribute with getattr, and calls the result as args_class(*args, **kwargs) where kwargs is the config's own init_args mapping. No allowlist constrains the dotted path, so a configuration may name any importable callable and supply the arguments it is called with. Vocos.from_hparams reaches this for each of the feature_extractor, backbone and head entries, and Vocos.from_pretrained reaches it with a remote file: it downloads config.yaml from a caller-named Hugging Face repository and passes it straight to from_hparams. Loading a model from a repository the user does not control therefore executes code of the repository owner's choosing in the loading process. The neighbouring torch.load of the downloaded weights is a separate matter and is constrained on PyTorch releases that default weights_only to true, which leaves this path as the reachable one.
Характеристики атаки
Последствия
Строка CVSS v4.0