AWS Certified AI Practitioner (AIF-C01) · Objective 2.3
Preventing output injection
2.3Standard
Display AI answers on a web page and turn some text into links.
Generated HTML or URLs must not execute.
Choose two controls.
Hint 1: Focus on the requirement
Treat generated text as untrusted data at every output boundary, and validate or escape it before a browser, query engine, or command interpreter sees it.
Hint 2: Key terms
Review output injection and escaping.
Output injection
An attack in which generated content is interpreted as HTML, script, SQL, or a command.
Output escaping
Encoding special characters so a destination interpreter treats them as data rather than syntax.
Schema validation
Checking structured output for allowed fields, types, formats, and values.
XSS
Cross-site scripting, in which untrusted content runs as script in another user's browser.
× Incorrect
Escape output, limit URL schemes, domains, and elements, validate structure, and separate display from executable operations.
Detailed explanation
A
CorrectHTML-escape output and restrict allowed URL schemes, domains, and elements
XSS and unsafe links are reduced.
B
IncorrectTrust model instructions and insert output into the DOM unchanged
Output can contain attacker-controlled text.
C
IncorrectAllow every script to make links work
The attack surface expands.
D
CorrectValidate structured output and separate display from executable processing
Generated text does not become code automatically.
Check official documentation
Compare the following points with the official documentation.
Path & Pass is an independent learning site and is not affiliated with any certification body. Questions are original practice content based on published objectives.