Skip to content

Implement Comprehensive DTO-Based Input Validation Across Endpoints #113

@onlydustapp

Description

@onlydustapp

Overview

Enhance input validation across all controller routes by replacing the limited express-validator approach with a robust, DTO-based validation mechanism using class-validator. This improvement ensures that all incoming requests are properly validated and sanitized before processing, reducing potential errors and security vulnerabilities.

Background

While express-validator is currently listed as a dependency, its usage is not enforced consistently across endpoints. By shifting to DTO-based validation, we align with our Domain-Driven Design (DDD) approach and ensure that all API requests meet the specified validation rules defined by @is* decorators.

Requirements

  • Convert input validation to use Data Transfer Objects (DTOs) with class-validator for every controller route.
  • Ensure that all input fields are properly sanitized and validated.
  • Update all relevant controllers to integrate with this validation mechanism.
  • Maintain clear error handling for scenarios where input validation fails.

Technical Considerations

  • The update should cover all endpoints defined in the project, ensuring consistency across the API.
  • Follow the existing project structure for the DTO layer (see Project Structure).
  • Make sure the updated validation logic adheres to the DTO-based approach outlined in the README.

Success Metrics

  • All controller routes should use DTOs with appropriate @is* decorators.
  • All inputs are sanitized and validated.
  • Successful handling of invalid input by returning informative error messages.

Timeline

  • Milestone: Validate all routes by the end of 2 days.

Let's get this improvement merged to make our APIs more robust and secure! 🚀

Metadata

Metadata

Assignees

Labels

BackendODHACK14onlydust-waveContribute to awesome OSS repos during OnlyDust's open source week

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions