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

Replace HttpException with BadRequestHttpException in CSRF validation #8272

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

desarrolla2
Copy link
Contributor

@desarrolla2 desarrolla2 commented Mar 10, 2025

Substitute HttpException with BadRequestHttpException to more accurately indicate a bad request (HTTP 400) error during CSRF token validation.

Subject

This PR refactors the CSRF token validation in the validateCsrfToken method by replacing HttpException with BadRequestHttpException. This change improves clarity by accurately indicating an HTTP 400 error when an invalid CSRF token is detected.

I am targeting this branch because the change is backward compatible and addresses an improvement in error semantics without breaking any existing functionality.

Changelog

### Changed
- Replaced the commented-out `HttpException` with `BadRequestHttpException` in the `validateCsrfToken` method to properly reflect an HTTP 400 error for invalid CSRF tokens

Substitute HttpException with BadRequestHttpException to more accurately indicate a bad request (HTTP 400) error during CSRF token validation.
@VincentLanglet VincentLanglet merged commit 711a764 into sonata-project:4.x Mar 11, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants