ITPEC FE Morning April 2020 Question 42

Source exam: ITPEC FE Morning April 2020Topic: Security

ITPEC FE Morning April 2020 — Question 42 of 80

XSS Countermeasure — filter/sanitize user input to prevent script injection.

XSS (Cross-Site Scripting) injects malicious scripts into web pages viewed by other users. The primary defense is input filtering/output encoding — stripping or escaping characters like <, >, ", ' so they cannot be interpreted as executable code.

Why not others:
- (a) Avoiding running email programs — protects against email malware, not XSS

- (b) Closing unnecessary ports — server hardening measure, unrelated to script injection

- (d) Using HTTPS — encrypts transport but does not prevent injected scripts from executing

Key rule: XSS prevention = sanitize input + encode output. Never trust user-supplied data rendered in HTML.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.