Multiple choice technology security

Which methods in the TCS SAPI can be used to prevent Cross Site Scripting Attacks?

  1. isSafeHTML(java.lang.String context, java.lang.String input, boolean allowNull) and encodeForHTML(java.lang.String input)

  2. isSafeHTML(java.lang.String context, java.lang.String input)

  3. SafeHTML(java.lang.String context, java.lang.String input)

  4. ValidHTML(java.lang.String context, java.lang.String input)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

isSafeHTML validates whether HTML content is safe from XSS attacks by checking for dangerous tags and attributes. encodeForHTML converts special characters like < and > to their HTML entity equivalents (<, >), preventing them from being interpreted as code. Together they provide comprehensive XSS protection.