Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Changing CSRF token default name#60537

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

ThomasLandauer
Copy link
Contributor

QA
Branch?7.3
Bug fix?no
New feature?not really
Deprecations?no
IssuesFix#60534
LicenseMIT

See#60534 (comment)

Copy link
Contributor

@SpomkySpomky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. No comment.

@OskarStarkOskarStark changed the title[Form] Changing CSRF token default name #60534[Form] Changing CSRF token default nameMay 25, 2025
@ThomasLandauer
Copy link
ContributorAuthor

Is it worth an entry in CHANGELOG? If yes, as bug or feature?

@nicolas-grekas
Copy link
Member

On my side, I think it's fine merging as "minor". Let's see if anyone else thinks different.

@xabbuh
Copy link
Member

I am not convinced. This has the potential to break applications where people render forms by referencing the CSRF field explicitly with the „old“ name.

skmedix and sstok reacted with thumbs up emoji

@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
@stof
Copy link
Member

I think this deserves being mentioned in the changelog, to account for the fact it might impact projects accessing the field by name.

Note that this PR does not change the name for users of the fullstack framework as you haven't changed the default value in the FrameworkBundle config.

@@ -253,7 +253,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode, callable $enableI
->children()
->scalarNode('enabled')->defaultNull()->end() // defaults to framework.csrf_protection.enabled
->scalarNode('token_id')->defaultNull()->end()
->scalarNode('field_name')->defaultValue('_token')->end()
->scalarNode('field_name')->defaultValue('_csrf_token')->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I am still 👎 on this change as I don't think it's worth it potentially breaking applications just to change the name of this field.

If we really want to change the default name we should IMO follow the usual deprecation-first approach: Meaning here that not setting the value explicitly would trigger a deprecation which would then allow us to change the default in 8.0.

skmedix, sstok, and welcoMattic reacted with thumbs up emoji
@ThomasLandauer
Copy link
ContributorAuthor

Thanks, I now changed it there too (and in the tests), and created aCHANGELOG.md file.

@SpomkySpomky self-requested a reviewMay 28, 2025 06:45
@Spomky
Copy link
Contributor

Hi,

I tested this on a project where the field is rendered manually, and as@xabbuh pointed out, it does break the token verification.
I have reconsidered my position and now agree with the downvoters as this change could indeed break applications.

welcoMattic, chalasr, and xabbuh reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

Let's close then. Thanks for proposing@ThomasLandauer but this looks like too costly for too little benefits.

@ThomasLandauerThomasLandauer deleted the renaming_csrf_token branchMay 28, 2025 16:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@xabbuhxabbuhxabbuh left review comments

@HanmacHanmacHanmac approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@SpomkySpomkyAwaiting requested review from Spomky

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

[Form] Rename CSRF token field from_token to_csrf_token
8 participants
@ThomasLandauer@nicolas-grekas@xabbuh@stof@Spomky@Hanmac@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp