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.

Use case of sanitize middlewares

See original GitHub issue

It’s possible to use sanitize methods (trim, normalizeEmail, escape…) in validators :

body('q')
  .trim()

I don’t understand when sanitize middleware are required :

sanitizeBody('q')
  .trim()

These two examples are the same for me.

Someone could explain me ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gustavohenkecommented, Jan 25, 2020

@BigFax indeed the sanitization middlewares don’t have a big space these days. They were mostly carried over from legacy APIs to the new ones, and they don’t do anything special. Will introduce some deprecation notices and eventually remove them.

0reactions
lock[bot]commented, Mar 27, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to sanitize input data in declarative manner in Laravel
These middlewares sanitize all input data of every request. But what if we need to sanitize only several fields of concrete request? Well, ......
Read more >
Should I implement user data sanitization/validation as ...
1 Answer 1 · Implement as route middleware so that you can have different filtering/validation for each endpoint. e.g. · Filter/validate within ...
Read more >
Sanitizing XSS and HTML with Express middleware - KrolTech
Lets take a look at a few different options for handling sanitizing user input fields in both node.js as well as the browser....
Read more >
Sanitization middlewares - express-validator
Sanitization middlewares ; sanitize(fields). field : a string or an array of strings of field names to validate against. · Sanitization Chain ;...
Read more >
Keep Your UI Clean With Redux Middleware | HackerNoon
The software in this layer contains application specific business rules. It encapsulates and implements all of the use cases of the system.
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