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

Extra characters to escape #516

Closed
bilbolovespotter opened this issue Mar 5, 2016 · 1 comment
Closed

Extra characters to escape #516

bilbolovespotter opened this issue Mar 5, 2016 · 1 comment

Comments

@bilbolovespotter
Copy link

Hi guys,

I think we should escape a few more dangerous characters for SQL and Javascript.

These two:

  • '
  • \

' is dangerous in sql and javascript and \ is too.

node_modules/validator/lib/filter.js
@@ -64,6 +64,7 @@ Filter.prototype.trim = function(chars) {
 Filter.prototype.escape = function() {
     this.modify(this.str.replace(/&/g, '&')
                         .replace(/"/g, '"')
+                        .replace(/'/g, ''')
+                        .replace(/\\/g, '&#5C;')
@chriso
Copy link
Collaborator

chriso commented Mar 5, 2016

Happy to accept a PR 😄

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

No branches or pull requests

2 participants