Skip to content

Add B901 plugin: detect unsafe yaml.load/full_load usage#1300

Open
ROSPL07 wants to merge 2 commits intoPyCQA:mainfrom
ROSPL07:feat/add-yaml-unsafe-check
Open

Add B901 plugin: detect unsafe yaml.load/full_load usage#1300
ROSPL07 wants to merge 2 commits intoPyCQA:mainfrom
ROSPL07:feat/add-yaml-unsafe-check

Conversation

@ROSPL07
Copy link
Copy Markdown

@ROSPL07 ROSPL07 commented Sep 16, 2025

What I Did

  • Added new plugin (B901) to detect unsafe usage of yaml.load, yaml.full_load, or yaml.unsafe_load.
  • Flags calls where Loader is not safe (e.g., FullLoader, Loader).
  • Added example file for testing.

Why

  • Unsafe YAML loading is a known Remote Code Execution risk.
  • This helps developers migrate to yaml.safe_load.

Impact

  • Improves static analysis coverage.
  • No breaking changes, safe to merge.

Copy link
Copy Markdown
Member

@ericwb ericwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sigmavirus24
Copy link
Copy Markdown
Member

We probably just need to fold some of the additions here into that set of checks. Would you be willing to do that @ROSPL07 ?

@ROSPL07
Copy link
Copy Markdown
Author

ROSPL07 commented Sep 16, 2025

We probably just need to fold some of the additions here into that set of checks. Would you be willing to do that @ROSPL07 ?

Sure, please share me the details.

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.

3 participants