question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[security issue!] Documentation change needed to prevent accidental XSS

See original GitHub issue

The documentation and examples for the template(Result|Selection) functions (and possibly others?) should warn that .nodeValue – and therefore jQuery’s .text()and therefore select2’s item.textcan return unescaped (valid) HTML.

See https://jsbin.com/zosigigece/edit?html,js,output using Chrome

The code there is just a slightly-modified version of the example in the current documentation in order to show the vulnerability.

Select2 version: latest (4.0.6-rc.0) Chrome version: 71.0.3578.98 OS: macOS 10.14.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
etiptoncommented, May 1, 2019

If it helps, here’s the html-escaping functionality I’ve used for awhile now, when needed: http://shebang.brandonmintern.com/foolproof-html-escaping-in-javascript/

Read more comments on GitHub >

github_iconTop Results From Across the Web

【Cross Site Scripting Prevention】Protect and Prevent XSS
How to prevent XSS attacks? Cross site scripting defense is important to avoid vulnerabilities and future attacks. Check now our list.
Read more >
10.1. Preventing Cross Site Scripting Vulnerabilities
Cross Site Scripting (XSS) vulnerabilities allow user-supplied data to be incorrectly executed as code in a web browser. It can be difficult to...
Read more >
Protect from cross-site scripting attacks - IBM Garage Practices
To prevent XSS attacks, your application must validate all the input data, make sure that only the allowlisted data is allowed, and ensure...
Read more >
Effective Ways to Prevent Cross Site Scripting(XSS) Attacks
Their primary goal is to get the project finished Websites developed with unsecure coding can be easily exploited by the attackers. There is...
Read more >
Recommended Practice Case Study: Cross-Site Scripting - CISA
This document was developed for the U.S. Department of Homeland. Security to provide guidance for control system cyber security. The author team consisted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found