-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fixes for cookie signing #315
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -34,7 +34,7 @@ public function getSignedValue(string $value, ?string $signature = null): string | |||||||||||
$signature = $this->generateSignature($value); | ||||||||||||
} | ||||||||||||
|
||||||||||||
return $value.'.'.$signature; | ||||||||||||
return $value.','.$signature; | ||||||||||||
} | ||||||||||||
|
||||||||||||
public function verifySignedValue(string $signedValue): bool | ||||||||||||
|
@@ -75,7 +75,7 @@ private function generateSignature(string $value): string | |||||||||||
*/ | ||||||||||||
private function splitSignatureFromSignedValue(string $signedValue): array | ||||||||||||
{ | ||||||||||||
$pos = strrpos($signedValue, '.'); | ||||||||||||
$pos = strrpos($signedValue, ','); | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not so sure about this.. On one hand it seems ok as a workaround, although I would like to still have BC here for On the other hand, it seems like the root cause is that you are signing session cookies, and NelmioSecurityBundle/src/EventListener/SignedCookieListener.php Lines 57 to 61 in 7cc3a47
So IMO we should probably write to $_COOKIE to unsign the cookies as well as writing to the request.. Any opinion here @nicolas-grekas from the Symfony/session perspective? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternative fix would be to NOT sign the session cookie ever even if |
||||||||||||
if (false === $pos) { | ||||||||||||
return [$signedValue, null]; | ||||||||||||
} | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.