Principle:Trailofbits Fickling Safety Verification
| Knowledge Sources | |
|---|---|
| Domains | Security, Validation, Deserialization |
| Last Updated | 2026-02-14 14:00 GMT |
Overview
A convenience mechanism that provides a simple boolean assessment of whether a pickle file is likely safe to load, combining bytecode validation and full safety analysis into a single decision.
Description
Safety Verification is a high-level abstraction over the full analysis pipeline. Given a file path, it:
- Opens and parses the pickle bytecode
- Checks for invalid opcodes (immediate rejection)
- Runs the complete safety analysis via check_safety
- Returns True only if the overall severity is LIKELY_SAFE
This is designed for quick gate checks where a binary safe/unsafe decision is needed without dealing with the full AnalysisResults API.
Usage
Use this for simple validation gates — file upload acceptance checks, pre-load guards, or batch scanning where you only need a pass/fail result.
Theoretical Basis
# Pseudocode: Boolean safety gate
def is_safe(filepath):
pickled = parse(filepath)
if has_invalid_opcodes(pickled):
return False
results = check_safety(pickled)
return results.severity == LIKELY_SAFE