diff --git a/snappymail/v/0.0.0/app/handle.php b/snappymail/v/0.0.0/app/handle.php index 8c4d2dffe..be12952aa 100644 --- a/snappymail/v/0.0.0/app/handle.php +++ b/snappymail/v/0.0.0/app/handle.php @@ -28,6 +28,11 @@ if (!\defined('RAINLOOP_APP_LIBRARIES_PATH')) if (\class_exists('RainLoop\Api')) { + if (!\SnappyMail\HTTP\SecFetch::site('same-origin') + && !\SnappyMail\HTTP\SecFetch::site('none')) { + exit('Invalid Sec-Fetch'); + } + \MailSo\Base\Loader::Init(); if (!empty($_ENV['RAINLOOP_INCLUDE_AS_API'])) diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/http/secfetch.php b/snappymail/v/0.0.0/app/libraries/snappymail/http/secfetch.php new file mode 100644 index 000000000..34eb7f598 --- /dev/null +++ b/snappymail/v/0.0.0/app/libraries/snappymail/http/secfetch.php @@ -0,0 +1,95 @@ + tag. + * audioworklet + * The destination is data being fetched for use by an audio worklet. This might originate from a call to audioWorklet.addModule(). + * document + * The destination is a document (HTML or XML), and the request is the result of a user-initiated top-level navigation (e.g. resulting from a user clicking a link). + * embed + * The destination is embedded content. This might originate from an HTML tag. + * empty + * The destination is the empty string. This is used for destinations that do not have their own value. For exmaple fetch(), navigator.sendBeacon(), EventSource, XMLHttpRequest, WebSocket, etc. + * font + * The destination is a font. This might originate from CSS @font-face. + * frame + * The destination is a frame. This might originate from an HTML tag. + * iframe + * The destination is an iframe. This might originate from an HTML