Skip to content

feat(api): BA-120 enforce strict global request validation rejecting unknown DTO properties - #1040

Open
ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/strict-validation-1033
Open

ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/strict-validation-1033

Conversation

@ranjeetprabhatedu-dotcom

Copy link
Copy Markdown

Summary

This PR implements BA-120 to enforce strict global request validation across the application.

  • Configures ValidationPipe with whitelist: true, transform: true, and forbidNonWhitelisted: true to reject unknown DTO properties without stripping or silently accepting them.
  • Provides APP_PIPE in AppModule so strict validation is globally enforced across all module boundaries and integration contexts.
  • Adds comprehensive unit tests in app.controller.spec.ts verifying that payloads with unrecognized fields throw BadRequestException with specific property warnings, while valid DTO payloads pass smoothly.
  • Scoped strictly to the 3 allowlisted files:
    • BackendAcademy/src/main.ts
    • BackendAcademy/src/app.module.ts
    • BackendAcademy/src/app.controller.spec.ts

Closes #1033

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

Successfully merging this pull request may close these issues.

BA-120 — Keep global request validation enabled and strict

1 participant