54. A stored support comment appears in both a web page and a downloadable report. How should output protection be designed?
MediumApplication & data security
Technical
Show model answer
Treat stored comments as untrusted wherever they are rendered. The correct handling depends on the destination context; a transformation safe for ordinary HTML text is not automatically safe in an attribute, script or another document format.
Use safe rendering primitives and context-appropriate encoding or sanitization through maintained libraries. Review each output path and test harmless adversarial fixtures. Restrictive browser policies add defense but do not replace correct output handling.
What interviewers listen for
- Identify each rendering context
- Use context-appropriate safe primitives
- Test every output path