Skip to content

Commit 423ec3d

Browse files
committed
removed samesite check using cookie (BC break)
1 parent 623ae53 commit 423ec3d

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
@@ -41,7 +41,7 @@ public function getConfigSchema(): Nette\Schema\Schema
4141
'cookiePath' => Expect::string()->dynamic(),
4242
'cookieDomain' => Expect::string()->dynamic(),
4343
'cookieSecure' => Expect::anyOf('auto', null, true, false)->firstIsDefault()->dynamic(), // Whether the cookie is available only through HTTPS
44-
'disableNetteCookie' => Expect::bool(false), // disables cookie use by Nette
44+
'disableNetteCookie' => Expect::bool(false)->deprecated(),
4545
]);
4646
}
4747

@@ -140,13 +140,6 @@ private function sendHeaders(): void
140140
$this->initialization->addBody('$response->setHeader(?, ?);', [$key, $value]);
141141
}
142142
}
143-
144-
if (!$config->disableNetteCookie) {
145-
$this->initialization->addBody(
146-
'Nette\Http\Helpers::initCookie($this->getService(?), $response);',
147-
[$this->prefix('request')],
148-
);
149-
}
150143
}
151144

152145

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 getReferer() Returns referrer.
16-
* @method bool isSameSite() Is the request sent from the same origin?
1716
* @method bool isFrom(string|list<string>|null $site = null, string|list<string>|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
@@ -232,13 +232,6 @@ public function isSecured(): bool
232232
}
233233

234234

235-
/** @deprecated use isFrom(['same-site', 'same-origin']) */
236-
public function isSameSite(): bool
237-
{
238-
return isset($this->cookies[Helpers::StrictCookieName]);
239-
}
240-
241-
242235
/**
243236
* Checks whether Sec-Fetch headers match the expected values.
244237
* @param string|list<string>|null $site

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)