bcgov / bcgov/SIMS

Sanitize NestJS Input in all the API Controllers

Open
#3,797 1 comment 0 reactions 0 assignees View on GitHub
Dev & Architecture Technical Debt Waiting
Dominant language
TypeScript
Stars
29
Forks
15
Avg merge
1d 14h
Merged PRs (30d)
38

Description

**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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the NestJS API controllers and the existing global validation setup. Check how controller inputs are currently validated, then verify that string inputs are sanitized consistently across endpoints and confirm the behavior with the project's existing controller tests, if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.