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

[HttpFoundation] Do not swallow trailing= in cookie value#51819

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

Merged

Conversation

@OskarStark
Copy link
Contributor

@OskarStarkOskarStark commentedOct 2, 2023
edited
Loading

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#51814
LicenseMIT

cc@pschultz as you opened the bug report

@OskarStarkOskarStark self-assigned thisOct 2, 2023
@carsonbotcarsonbot added this to the5.4 milestoneOct 2, 2023
@OskarStarkOskarStark changed the title[HttpFoundation] Do not swallow trailing equal sign in cookie value[HttpFoundation] Do not swallow trailing= in cookie valueOct 2, 2023
@OskarStark
Copy link
ContributorAuthor

Or should this be fixed inside HeaderUtils::split() method?

@stof
Copy link
Member

stof commentedOct 3, 2023

I guess we have similar bugs in other places usingHeaderUtils::split with multiple separator (i.e. all of them). That's because HeaderUtils considers that all separators are list separators. But= is a key-value separator.

@OskarStark
Copy link
ContributorAuthor

So do you have a proposal on where to fix this?

@stof
Copy link
Member

stof commentedOct 3, 2023

Well, HeaderUtils should be the place to fix it, but not sure we can fix it with the existing signature (unless we hardcode a special behavior for=).

@nicolas-grekas
Copy link
Member

The bug is clearly in HeaderUtils, see

[[['foo_cookie','foo=='], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],

foo_cookie=foo== is correctly parsed whilefoo_cookie=foo= isn't

@OskarStark
Copy link
ContributorAuthor

Will check on Monday 👍🏻

@OskarStarkOskarStarkforce-pushed thebug/cookie-trailing-equal-sign branch from7cf16b0 to360e0adCompareOctober 9, 2023 09:47
@OskarStark
Copy link
ContributorAuthor

Review please

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

The whole logic is opaque to me 😓

@OskarStarkOskarStarkforce-pushed thebug/cookie-trailing-equal-sign branch fromf2d7a47 toed51a41CompareOctober 13, 2023 10:51
@nicolas-grekasnicolas-grekasforce-pushed thebug/cookie-trailing-equal-sign branch 2 times, most recently from469f98b to59d6acfCompareOctober 17, 2023 09:23
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I rewrote the implementation, it now makes sense, at least to me :)
AND, it handles more edge cases.

OskarStark reacted with hooray emoji
@nicolas-grekasnicolas-grekasforce-pushed thebug/cookie-trailing-equal-sign branch from59d6acf to77ca01cCompareOctober 17, 2023 09:25
@OskarStark
Copy link
ContributorAuthor

Thank you Nicolas!! 👏

[['foo bar'],'"foo" "bar"',','],

[[['foo_cookie','foo=1&bar=2&baz=3'], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo=1&bar=2&baz=3; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],
[[['foo_cookie','foo=='], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Suggested change
[[['foo_cookie','foo=='], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],
[[['foo_cookie','foo==='], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo===; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],
[[['foo_cookie','foo=='], ['expires','Tue, 22-Sep-2020 06:27:09 GMT'], ['path','/']],'foo_cookie=foo==; expires=Tue, 22-Sep-2020 06:27:09 GMT; path=/',';='],

Does this pass as well?

Choose a reason for hiding this comment

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

yes

OskarStark reacted with thumbs up emoji
@nicolas-grekas
Copy link
Member

Thank you@OskarStark.

@nicolas-grekasnicolas-grekas merged commita0df509 intosymfony:5.4Oct 17, 2023
@OskarStarkOskarStark deleted the bug/cookie-trailing-equal-sign branchOctober 17, 2023 11:42
@OskarStark
Copy link
ContributorAuthor

Thank you, as you did the reimplementation 👍

@fabpotfabpot mentioned this pull requestOct 21, 2023
@fabpotfabpot mentioned this pull requestOct 29, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@stofstofAwaiting requested review from stof

Assignees

@OskarStarkOskarStark

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

4 participants

@OskarStark@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp