nerdexam
Salesforce

CRT-450 · Question #77

A developer has a Apex controller for a Visualforce page that takes an ID as a URL parameter. How should the developer prevent a cross site scripting vulnerability?

The correct answer is B. ApexPages.currentPage() .getParameters() .get('url_param') .escapeHtml4(). See the full explanation below for the reasoning.

Question

A developer has a Apex controller for a Visualforce page that takes an ID as a URL parameter. How should the developer prevent a cross site scripting vulnerability?

Options

  • AApexPages.currentPage() .getParameters() .get('url_param')
  • BApexPages.currentPage() .getParameters() .get('url_param') .escapeHtml4()
  • CString.ValueOf(ApexPages.currentPage() .getParameters() .get('url_param'))
  • DString.escapeSingleQuotes(ApexPages.currentPage() .getParameters(). get('url_param'))

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    72% (18)
  • C
    16% (4)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full CRT-450 Practice