Skip to content

[SecurityBundle] Stop delete_cookies keys from being normalized #24018

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

Conversation

thewilkybarkid
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Currently the cookie names inside delete_cookies are normalized, so using YAML a cookie with the name 'foo-bar' becomes 'foo_bar', and so isn't deleted.

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

Related to 8d03332

@thewilkybarkid
Copy link
Contributor Author

AppVeyor failure looks unrelated.

@chalasr
Copy link
Member

chalasr commented Aug 29, 2017

As for #21718 doing this now is a BC break, people might rely on the current behavior and/or workaround it on their side.
The BC break is more impactful here since the changed value is also used in prod env.
I'll try to think about an upgrade path today if nobody suggests one, but 👎 as is to me.

@stof
Copy link
Member

stof commented Aug 29, 2017

A BC layer could be to add the underscore version of cookie names in the list whenever a dashed one is here, to keep clearing the underscore version too (it would then clear 2 cookies).

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Aug 29, 2017
@chalasr
Copy link
Member

chalasr commented Aug 29, 2017

@thewilkybarkid Would you mind looking at @stof's suggestion? I can do it if you don't.

@chalasr chalasr modified the milestones: 3.4, 2.7 Aug 29, 2017
@chalasr
Copy link
Member

chalasr commented Aug 29, 2017

This is for 3.4 as it is a behavior change and should include deprecations, branch needs to be rebased and PR retargeted.

@thewilkybarkid
Copy link
Contributor Author

Don't see how this is a BC break? I don't think it's possible to rely on the current behaviour (since it's mangling the name), and if you have an existing workaround then that would continue to work? If you want underscores if your cookie name why wouldn't you have used that already?

@chalasr
Copy link
Member

chalasr commented Aug 30, 2017

If you want underscores if your cookie name why wouldn't you have used that already?

Dunno, probably no viable reason. But fact is that if one set a name with dashes and ends up with underscores, one could just forgot about the name set in the config and implicitly rely on this behavior. For the same input the final value will be different than before, that is a behavior change which can break.

@thewilkybarkid
Copy link
Contributor Author

But why prioritise someone who's incorrectly configured the cookie name here (using dashes when they meant underscores) over someone who's being bitten by this bug (probably without realising)?

@chalasr
Copy link
Member

chalasr commented Sep 2, 2017

@thewilkybarkid That is where I disagree. Incorrectly or not, the one who did configure it could be a different person that the one who rely on the unexpected result, thinking it's expected, letting untouched and just dealing with underscores... Breaking (edge) cases are easy to imagine here.
This behavior exists for years and this changes it, but we don't want to bother our users for no strong reason (given you can avoid normalization by explicitly setting the name attribute instead of using the cookie name as key, right?).

@weaverryan
Copy link
Member

I agree with Stof and @chalasr. This is obviously a worthwhile fix - definitely was a bug/mistake originally. But we should add the BC layer.

@thewilkybarkid Feature freeze is this weekend? Would you have time to update your PR before then?

Thanks!

@nicolas-grekas
Copy link
Member

Moving to 4.1. Rebase on master might be needed, where PHP 7.1 features can be used btw.

@javiereguiluz
Copy link
Member

This is tricky ... but Symfony's policy in similar situations has always been:

  1. If this is considered a bug, then we can fix it, even if that changes the behavior and introduces a BC break...
  2. ..."BC breaks" are not considered for bug fixes, because otherwise, every single bug fix would be a "BC break" (you are changing the previous code behavior!)

So I'd say, this is a bug fix and not a BC break.

@chalasr
Copy link
Member

chalasr commented Jul 4, 2018

Still -1 for me without BC layer, not worth the breaking change as there is a valid way to avoid this behavior (by specifying name: ... instead of using the name as key).
All keys are normalized by default (that could be reconsidered on master) and that's consistent with the decision made on the very same issue regarding other config nodes in the past. @thewilkybarkid should we close/take over?

@thewilkybarkid
Copy link
Contributor Author

Still don't agree that it needs a BC layer since it's a bug that doesn't have behaviour that can be relied on.

But I'd much rather the bug is fixed than having this left open, so do whatever's needed to have it resolved.

@chalasr
Copy link
Member

chalasr commented Feb 11, 2019

Closing in favor of #30111, thank you for rising the issue.

@chalasr chalasr closed this Feb 11, 2019
fabpot added a commit that referenced this pull request Feb 12, 2019
…okie names (javiereguiluz)

This PR was squashed before being merged into the 4.3-dev branch (closes #30111).

Discussion
----------

[SecurityBundle] Deprecate the normalization of the cookie names

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This is an alternative solution to #24018 providing a BC layer until Symfony 5.0.

Commits
-------

36c5df4 [SecurityBundle] Deprecate the normalization of the cookie names
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.3 Apr 30, 2019
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.

9 participants