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

Add "headers" to middleware #5

Closed
GiordanoArman opened this issue Apr 20, 2018 · 2 comments
Closed

Add "headers" to middleware #5

GiordanoArman opened this issue Apr 20, 2018 · 2 comments

Comments

@GiordanoArman
Copy link

GiordanoArman commented Apr 20, 2018

What about adding the headers to the array of req values that get sanitized? Let's say an application uses an Authorization header, which or example could be "[email protected]:thisIsThePassWord", right now this module would not protect against an attack that exploits the headers feature.

The bit to change would be:

function middleware(options) {
  return function(req, res, next) {
    ['body', 'params', 'query', 'headers'].forEach(function(k) {
      if(req[k]) {
        req[k] = sanitize(req[k], options);
      }
    });
    next();
  };
}

Let me know what you think!

@fiznool
Copy link
Owner

fiznool commented Sep 1, 2019

This is a good idea. If you could put together a PR with corresponding tests I would gladly merge this in!

@fiznool
Copy link
Owner

fiznool commented Mar 25, 2020

Fixed in v2.0.0.

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

2 participants