Skip to content

hardening(validation): enforce Bean Validation and stabilize 400 contract#42

Merged
MarkADom merged 2 commits intodevelopfrom
hardening/validation-safe-pass
Mar 3, 2026
Merged

hardening(validation): enforce Bean Validation and stabilize 400 contract#42
MarkADom merged 2 commits intodevelopfrom
hardening/validation-safe-pass

Conversation

@MarkADom
Copy link
Copy Markdown
Owner

@MarkADom MarkADom commented Mar 3, 2026

Summary

This PR stabilizes the API input contract by:

  • Applying structural Bean Validation to critical inbound DTOs
  • Enforcing @Valid on request-body controller methods
  • Mapping IllegalArgumentException to HTTP 400
  • Updating unit and Bruno validation tests

Invalid input now consistently returns 400 Bad Request instead of 500.

No architectural or business logic changes were introduced.

Type of change

  • feat
  • fix
  • hardening
  • refactor
  • docs
  • test
  • ci

Validation

  • I ran local checks
  • I included commands/results below

Commands run:

./gradlew clean test
# Bruno suite executed locally (all green)

Docs impact

  • No docs change needed
  • Updated README/docs
  • Updated API tests (Bruno)

Security impact

  • No security impact
  • Security-relevant change explained below

This change improves API robustness by preventing invalid payloads from propagating into deeper layers and causing unintended 500 responses.

No changes were made to authentication, authorization, or cryptographic configuration.

…egalArgumentException to 400, update tests
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 3, 2026

@MarkADom MarkADom merged commit 0aae748 into develop Mar 3, 2026
3 checks passed
@MarkADom MarkADom deleted the hardening/validation-safe-pass branch March 3, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant