Do not use insecure YAML deserialization

Metadata

ID: python-security/ruamel-unsafe-yaml

Language: Python

Severity: Error

Category: Security

CWE: 502

Description

Unsafe YAML deserialization. Make sure to use safe deserialization methods to avoid execution or arbitrary code.

Learn More

Non-Compliant Code Examples

from ruamel.yaml import YAML

foo = YAML(typ='unsafe')

def myfunction(arg):
    bar = YAML(typ='base')

Compliant Code Examples

foo = YAML(typ='unsafe')

def myfunction(arg):
    bar = YAML(typ='base')
from ruamel.yaml import YAML

default = YAML()

rt = YAML(typ='rt')

safe = YAML(typ='safe')
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis

PREVIEWING: safchain/fix-custom-agent