🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: XSS: all 10 questions

Quiz: XSS · Question 9 of 10

A course description must allow bold text and links from instructors. What is the safe approach?

A course description must allow bold text and links from instructors. What is the safe approach?

  1. A.Turn off escaping for that field
  2. B.Sanitise the HTML with an allow-list of tags and attributes using a trusted library
  3. C.Remove the word "script" from the text
  4. D.Store it in a cookie
Answer & explanation

Correct answer: Sanitise the HTML with an allow-list of tags and attributes using a trusted library

Allow only known-safe tags such as b, i and a with a checked href.

Can you get the rest right without peeking?

Take the timed Quiz: XSS quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →