mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Improved Sec-Fetch
See https://github.com/the-djmaze/snappymail/issues/99#issuecomment-879702411
This commit is contained in:
parent
e73e81664f
commit
d85cc9a79f
1 changed files with 9 additions and 9 deletions
|
|
@ -50,7 +50,7 @@ abstract class SecFetch
|
||||||
*/
|
*/
|
||||||
public static function dest(string $type) : bool
|
public static function dest(string $type) : bool
|
||||||
{
|
{
|
||||||
return $type == ($_SERVER['HTTP_SEC_FETCH_DEST'] ?? 'document');
|
return $type === ($_SERVER['HTTP_SEC_FETCH_DEST'] ?? 'document');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,7 +67,7 @@ abstract class SecFetch
|
||||||
*/
|
*/
|
||||||
public static function mode(string $type) : bool
|
public static function mode(string $type) : bool
|
||||||
{
|
{
|
||||||
return $type == ($_SERVER['HTTP_SEC_FETCH_MODE'] ?? 'navigate');
|
return $type === ($_SERVER['HTTP_SEC_FETCH_MODE'] ?? 'navigate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,12 +85,12 @@ abstract class SecFetch
|
||||||
*/
|
*/
|
||||||
public static function site(string $type) : bool
|
public static function site(string $type) : bool
|
||||||
{
|
{
|
||||||
return $type == ($_SERVER['HTTP_SEC_FETCH_SITE'] ?? 'none');
|
return $type === ($_SERVER['HTTP_SEC_FETCH_SITE'] ?? 'none');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function user() : bool
|
public static function user() : bool
|
||||||
{
|
{
|
||||||
return '?1' == ($_SERVER['HTTP_SEC_FETCH_USER'] ?? '');
|
return '?1' === ($_SERVER['HTTP_SEC_FETCH_USER'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isSameOrigin() : bool
|
public static function isSameOrigin() : bool
|
||||||
|
|
@ -99,10 +99,10 @@ abstract class SecFetch
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('none' == $_SERVER['HTTP_SEC_FETCH_SITE']) {
|
if (static::user()) {
|
||||||
// sec-fetch-dest: document
|
return static::dest('document')
|
||||||
// sec-fetch-mode: navigate
|
&& static::mode('navigate')
|
||||||
return static::user();
|
&& 'GET' === $_SERVER['REQUEST_METHOD'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -116,7 +116,7 @@ abstract class SecFetch
|
||||||
sec-fetch-dest: document
|
sec-fetch-dest: document
|
||||||
sec-fetch-mode: navigate
|
sec-fetch-mode: navigate
|
||||||
*/
|
*/
|
||||||
return 'same-origin' == $_SERVER['HTTP_SEC_FETCH_SITE'];
|
return 'same-origin' === $_SERVER['HTTP_SEC_FETCH_SITE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue