Skip to content

Commit 80e8e2b

Browse files
committed
removed samesite check using cookie (BC break)
1 parent 60d41c0 commit 80e8e2b

File tree

6 files changed

+1
-84
lines changed

6 files changed

+1
-84
lines changed

src/Bridges/HttpDI/HttpExtension.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function getConfigSchema(): Nette\Schema\Schema
4040
'cookiePath' => Expect::string()->dynamic(),
4141
'cookieDomain' => Expect::string()->dynamic(),
4242
'cookieSecure' => Expect::anyOf('auto', null, true, false)->firstIsDefault()->dynamic(), // Whether the cookie is available only through HTTPS
43-
'disableNetteCookie' => Expect::bool(false), // disables cookie use by Nette
43+
'disableNetteCookie' => Expect::bool(false)->deprecated(),
4444
]);
4545
}
4646

@@ -133,13 +133,6 @@ private function sendHeaders(): void
133133
$this->initialization->addBody('$response->setHeader(?, ?);', [$key, $value]);
134134
}
135135
}
136-
137-
if (!$config->disableNetteCookie) {
138-
$this->initialization->addBody(
139-
'Nette\Http\Helpers::initCookie($this->getService(?), $response);',
140-
[$this->prefix('request')],
141-
);
142-
}
143136
}
144137

145138

src/Http/Helpers.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ final class Helpers
2121
{
2222
use Nette\StaticClass;
2323

24-
/** @internal */
25-
public const StrictCookieName = '_nss';
26-
2724

2825
/**
2926
* Returns HTTP valid date format.
@@ -51,10 +48,4 @@ public static function ipMatch(string $ip, string $mask): bool
5148

5249
return strncmp($ip, $mask, $size === '' ? $max : (int) $size) === 0;
5350
}
54-
55-
56-
public static function initCookie(IRequest $request, IResponse $response): void
57-
{
58-
$response->setCookie(self::StrictCookieName, '1', 0, '/', sameSite: IResponse::SameSiteStrict);
59-
}
6051
}

src/Http/IRequest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
/**
1414
* HTTP request provides access scheme for request sent via HTTP.
1515
* @method UrlImmutable|null getReferer() Returns referrer.
16-
* @method bool isSameSite() Is the request sent from the same origin?
1716
* @method bool isFrom(string|array|null $site = null, string|array|null $initiator = null)
1817
*/
1918
interface IRequest

src/Http/Request.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,6 @@ public function isSecured(): bool
222222
}
223223

224224

225-
/** @deprecated use isFrom(['same-site', 'same-origin']) */
226-
public function isSameSite(): bool
227-
{
228-
return isset($this->cookies[Helpers::StrictCookieName]);
229-
}
230-
231-
232225
/**
233226
* Checks whether Sec-Fetch headers match the expected values.
234227
*/

tests/Http.DI/HttpExtension.sameSiteProtection.disabled.phpt

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/Http.DI/HttpExtension.sameSiteProtection.phpt

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)