Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.xss() is incorrectly escaping the < to &lt; of the closing tag #226

Closed
balupton opened this issue Oct 9, 2013 · 2 comments
Closed

.xss() is incorrectly escaping the < to &lt; of the closing tag #226

balupton opened this issue Oct 9, 2013 · 2 comments

Comments

@balupton
Copy link

balupton commented Oct 9, 2013

I'm getting the following result with version 1.5.1:

node -e "console.log(require('validator').sanitize('<code>&lt;head&gt;</code>').xss())"
<code>&lt;head&gt;&lt;/code>

Where I would expect it to stay the same:

node -e "console.log(require('validator').sanitize('<code>&lt;head&gt;</code>').xss())"
<code>&lt;head&gt;</code>
chriso added a commit that referenced this issue Oct 31, 2013
The xss() function was originally a port of the XSS filter from
CodeIgniter. I added it to the library because there wasn't an
alternative at the time. Unfortunately I don't have the time or
expertise to maintain the XSS filter or keep merging upstream
changes.

If you need one for your app, I suggest looking at Caja sanitisation
engine maintained by Google. (https://code.google.com/p/google-caja/
source/browse/trunk/src/com/google/caja/plugin/html-sanitizer.js)

Closes #123, #138, #181, #206, #210, #221, #223, #226, #227, #231, #232
@chriso chriso closed this as completed Oct 31, 2013
@mreinstein
Copy link

@chriso I'm curious why the removal of xss() ? Is there a recommended alternative module to handle this escaping? It's a great filter to support.

@chriso
Copy link
Collaborator

chriso commented Nov 3, 2013

The commit message has more info

The xss() function was originally a port of the XSS filter from
CodeIgniter. I added it to the library because there wasn't an
alternative at the time. Unfortunately I don't have the time or
expertise to maintain the XSS filter or keep merging upstream
changes.

If you need one for your app, I suggest looking at Caja sanitisation
engine maintained by Google. (https://code.google.com/p/google-caja/
source/browse/trunk/src/com/google/caja/plugin/html-sanitizer.js)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants