---
name: "insecure-deserialization-guard"
description: "Prevent remote code execution by replacing unsafe object deserializers with typed schemas."
metadata:
  author: "OWASP"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "prevent insecure deserialization"
  - "replace pickle with json"
  - "use yaml safe_load"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Insecure Deserialization Defense & Safe Decoders

Eliminates object deserialization vulnerabilities: banning Python pickle/yaml.load(Loader=Loader), Java native serialization, PHP unserialize(), and enforcing typed JSON schema parsing.

## When to Invoke
Invoke this skill whenever you need to:
- prevent insecure deserialization
- replace pickle with json
- use yaml safe_load

## Execution SOP & Rules
1. Never deserialize untrusted data using native language object deserializers (pickle, marshal).
2. Use yaml.safe_load() rather than yaml.load() when parsing YAML documents.
3. Validate deserialized data structures strictly using typed schemas (Pydantic, Zod).
4. Digitally sign serialized data with HMAC-SHA256 if binary serialization must be retained.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
