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

Sanitize NestJS Input in all the API Controllers #3797

Open
sh16011993 opened this issue Oct 16, 2024 · 0 comments
Open

Sanitize NestJS Input in all the API Controllers #3797

sh16011993 opened this issue Oct 16, 2024 · 0 comments
Labels
Dev & Architecture Development and Architecture Technical Debt Waiting Waiting for other activity, requirement or deliverable before it can be actioned.

Comments

@sh16011993
Copy link
Collaborator

Describe the task

Currently, the input received in the API controllers is handling validations by using decorators. But the sanitization of the received input is not happening. For example, input parameters like firstName, lastName etc (string) need to be trimmed before using them as a part of the logic in code.

One way to do this globally for all inputs across all controller endpoints could be to create global pipes like creating a TrimPipe to trim the inputs and likewise for other types of sanitizations as needed.

Reference Links:

https://stackoverflow.com/questions/63766390/using-nest-js-i-would-like-to-trim-all-body-input-values
https://stackoverflow.com/questions/64313399/how-to-properly-sanitize-nestjs-input

@andrewsignori-aot andrewsignori-aot added the Dev & Architecture Development and Architecture label Oct 16, 2024
@ninosamson ninosamson added the Waiting Waiting for other activity, requirement or deliverable before it can be actioned. label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev & Architecture Development and Architecture Technical Debt Waiting Waiting for other activity, requirement or deliverable before it can be actioned.
Projects
None yet
Development

No branches or pull requests

3 participants