이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

ID: python-security/deserialize-untrusted-data

Language: Python

Severity: Notice

Category: Security

CWE: 502

Description

Do not deserialize untrusted data. Make sure you use alternatives to check that the data can be deserialized safely. There is no workaround around this: unless you really trust the data source, it’s better to use another way to exchange data, such as an API or other protocols such as protobuf or thrift.

Learn More

Non-Compliant Code Examples

import marshal
person = {"name":"xyz", "age":22, "marks":[45,56,78]}
data = marshal.dumps(person)
obj = marshal.loads(data)
import pickle

data = pickle.loads(data)

Compliant Code Examples

import pickle

data = pickle.loads(data)
data = pickle.loads(data)
PREVIEWING: brett.blue/embedded-collector-release