Infrastructure Security

A support application inserts model-generated summaries directly into an HTML page, where a crafted response could execute browser script. Which control MOST directly addresses this risk?

Show the answer

Correct answerC. Apply context-aware output encoding before rendering.

AWhy not this: A grounded response can still contain markup that is unsafe to render directly.

BWhy not this: A short response can still contain executable markup; length limits do not make rendering safe.

CWhy this is right: Context-aware encoding prevents untrusted generated text from being interpreted as executable page content.

DWhy not this: Harmful-content filtering does not provide HTML-context escaping or prevent script execution.

Treat model output as untrusted and apply context-aware encoding before inserting it into HTML. Harmful-content filtering classifies content but is not a substitute for preventing browser interpretation of executable markup.