Skip to content

Switch to SafeLoader for secure YAML configuration parsing#309

Open
RinZ27 wants to merge 1 commit intoWenmuZhou:devfrom
RinZ27:fix/safe-yaml-loading
Open

Switch to SafeLoader for secure YAML configuration parsing#309
RinZ27 wants to merge 1 commit intoWenmuZhou:devfrom
RinZ27:fix/safe-yaml-loading

Conversation

@RinZ27
Copy link

@RinZ27 RinZ27 commented Feb 14, 2026

Loading configuration files using the standard yaml.Loader can lead to arbitrary code execution if a maliciously crafted YAML file is processed. Since the project's configuration files primarily use standard YAML features like anchors and aliases, switching to yaml.SafeLoader provides a more robust and secure implementation without breaking existing functionality.

Updates included:

  • Replaced yaml.Loader with yaml.SafeLoader in torchocr/engine/config.py for both command-line option parsing and file loading.
  • Updated convert_params_compute_diff.py to use SafeLoader when reading model configurations.

These changes ensure that users can safely load configurations from external sources or community-shared repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant