A JavaScript web application allows users to submit comments on articles. However, an attacker exploits a vulnerability in the comment submission form to inject a malicious script that steals users' session cookies. Which of the following best describes the type of attack and the appropriate mitigation strategy?

Attack type: Cross-Site Scripting (XSS) 

Mitigation: Implement input validation and output encoding.

Attack type: Cross-Site Request Forgery (CSRF) 

Mitigation: Generate and validate unique tokens for each user session.

Attack type: Cross-Site Scripting (XSS)

Mitigation: Use strong password policies to protect against session hijacking.

Attack type: Cross-Site Request Forgery (CSRF)

Mitigation: Restrict access to sensitive cookies through HTTP-only flags.

Verified Answer
Correct Option - a

To get all Infosys Certified JavaScript Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram