Salesforce-Platform-Developer Practice Test

Salesforce Spring 25 Release
237 Questions

Which code in a Visualforce page and/or controller might present a security vulnerability?

A. Option A

B. Option B

C. Option C

D. Option D

B.   Option B

Explanation:

Why Option B is a Security Vulnerability:

This code outputs user-supplied input ($CurrentPage.parameters.userInput) without escaping it (escape="false").
Disabling escaping exposes the page to Cross-Site Scripting (XSS), where malicious scripts can be injected and executed in the user’s browser.
User input should always be escaped or validated to avoid code injection attacks.

Why Not the Other Options:

A.
This uses controller-bound data (ctrl.userinput) and doesn’t display raw URL input.
apex:outputField automatically escapes HTML, so it’s safe.

C.
Similar to A, this uses safe output escaping via outputField.

D.
Though this uses raw user input from the URL, it does escape HTML by default, mitigating XSS.

Salesforce-Platform-Developer Exam Questions - Home Previous
Page 39 out of 237 Pages