---
title: Escape Data By Output Context
impact: MEDIUM
impactDescription: ensures correct encoding for each output context
tags: xss, escaping, context, encoding, security
---

## Escape Data By Output Context

This rule ensures high quality and security in Python and PySpark applications.

**Implementation Guidance:**
- Follow standard Python best practices (PEP 8)
- Use type hints for better clarity
- For PySpark, prefer DataFrame API over SQL strings where possible
- Ensure proper resource management (using \`with\` statements)
