2026-05-18 · 1 मिनट पढ़ाई
APIs और templates में HTML entity encoding
HTML या JSON string fields में embed से पहले user content escape करें।
HTMLsecurityXSS
मुख्य बिंदु
- Encoding context-specific है — HTML entities URL या JavaScript escaping replace नहीं करते।
- केवल trusted content decode करें; render से पहले attacker-controlled strings decode न करें।
सही escape चुनें
text nodes के लिए HTML entity encoding; query parameters के लिए URL encoding; JSON के अंदर JSON string escaping.
composite payloads बनाते समय tools को इसी order में chain करें।
अक्सर पूछे जाने वाले प्रश्न
क्या यह XSS रोकता है?
HTML में text insert करने में मदद करता है, लेकिन framework auto-escaping और CSP primary defenses रखें।
named vs numeric entities?
common characters दोनों supported; target template engine में output verify करें।