> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# python-unsafe-yaml-load

> yaml.load or yaml.load_all without SafeLoader or BaseLoader can construct arbitrary Python objects.

## What it flags

`yaml.unsafe_load` and `yaml.unsafe_load_all` can construct arbitrary objects. The rule also flags `yaml.load` and `yaml.load_all` without a recognized safe loader. It checks the second positional argument or the `Loader` keyword for imported `SafeLoader` and `BaseLoader` variants, including their LibYAML equivalents. The import can come from `yaml`, `yaml.loader` or `yaml.cyaml`, and can sit in a `try` statement whose `except ImportError` falls back to another safe loader.

## How to review or fix

Use `yaml.safe_load` or `yaml.safe_load_all` for standard YAML values. `BaseLoader` loads basic strings, lists and mappings.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "python-unsafe-yaml-load": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.