Skip to content

Commit

Permalink
[10.x] Cookies Having Independent Partitioned State (CHIPS) (#48745)
Browse files Browse the repository at this point in the history
* [10.x] Cookies Having Independent Partitioned State (CHIPS)

* Clean up cookie duplication

* Bump components symfony/http-foundation version
  • Loading branch information
fabricecw authored Nov 30, 2023
1 parent 378e4b3 commit bd30b02
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"symfony/console": "^6.2",
"symfony/error-handler": "^6.2",
"symfony/finder": "^6.2",
"symfony/http-foundation": "^6.3",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.2",
"symfony/mailer": "^6.2",
"symfony/mime": "^6.2",
Expand Down
6 changes: 1 addition & 5 deletions src/Illuminate/Cookie/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,7 @@ protected function encrypt(Response $response)
*/
protected function duplicate(Cookie $cookie, $value)
{
return new Cookie(
$cookie->getName(), $value, $cookie->getExpiresTime(),
$cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(),
$cookie->isHttpOnly(), $cookie->isRaw(), $cookie->getSameSite()
);
return $cookie->withValue($value);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cookie/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"illuminate/contracts": "^10.0",
"illuminate/macroable": "^10.0",
"illuminate/support": "^10.0",
"symfony/http-foundation": "^6.2",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.2"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ protected function newCookie($request, $config)
$config['secure'],
false,
false,
$config['same_site'] ?? null
$config['same_site'] ?? null,
$config['partitioned'] ?? false
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"illuminate/macroable": "^10.0",
"illuminate/session": "^10.0",
"illuminate/support": "^10.0",
"symfony/http-foundation": "^6.2",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.2",
"symfony/mime": "^6.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"illuminate/pipeline": "^10.0",
"illuminate/session": "^10.0",
"illuminate/support": "^10.0",
"symfony/http-foundation": "^6.2",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.2",
"symfony/routing": "^6.2"
},
Expand Down
13 changes: 10 additions & 3 deletions src/Illuminate/Session/Middleware/StartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,16 @@ protected function addCookieToResponse(Response $response, Session $session)
{
if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
$response->headers->setCookie(new Cookie(
$session->getName(), $session->getId(), $this->getCookieExpirationDate(),
$config['path'], $config['domain'], $config['secure'] ?? false,
$config['http_only'] ?? true, false, $config['same_site'] ?? null
$session->getName(),
$session->getId(),
$this->getCookieExpirationDate(),
$config['path'],
$config['domain'],
$config['secure'] ?? false,
$config['http_only'] ?? true,
false,
$config['same_site'] ?? null,
$config['partitioned'] ?? false
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Session/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"illuminate/filesystem": "^10.0",
"illuminate/support": "^10.0",
"symfony/finder": "^6.2",
"symfony/http-foundation": "^6.2"
"symfony/http-foundation": "^6.4"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ public function getCookie($cookieName, $decrypt = true, $unserialize = false)
$cookie->isSecure(),
$cookie->isHttpOnly(),
$cookie->isRaw(),
$cookie->getSameSite()
$cookie->getSameSite(),
$cookie->isPartitioned()
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Validation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"illuminate/macroable": "^10.0",
"illuminate/support": "^10.0",
"illuminate/translation": "^10.0",
"symfony/http-foundation": "^6.2",
"symfony/http-foundation": "^6.4",
"symfony/mime": "^6.2"
},
"autoload": {
Expand Down

0 comments on commit bd30b02

Please sign in to comment.