import { isSafari } from '@proton/shared/lib/helpers/browser';

const getIframeSandboxAttributes = (isPrint: boolean) => {
    /**
     * "allow-same-origin"
     *      Because iframe origin is set to protonmail.com we need
     *      to be able to access it's origin
     * "allow-modals"
     *      Allow to be able to print emails
     * "allow-scripts"
     *      allows react portals to execute correctly in Safari
     * "allow-popups"
     *      allows target="_blank" links to work
     * "allow-popups-to-escape-sandbox"
     *      allows to open links in non sandboxed mode
     *      for ex : if allow-scripts is not present opened links are allowed to execute scripts
     *
     * ATM we do not need to allow the following options
     * - allow-forms
     * - allow-pointer-lock
     * - allow-top-navigation
     */
    const sandboxAttributes: string = [
        'allow-same-origin',
        'allow-popups',
        'allow-popups-to-escape-sandbox',
        ...(isPrint ? ['allow-modals'] : []),
        ...(isSafari() ? ['allow-scripts'] : []),
    ].join(' ');

    return sandboxAttributes;
};

export default getIframeSandboxAttributes;

import { isSafari } from '@proton/shared/lib/helpers/browser';

const getIframeSandboxAttributes = (isPrint: boolean) => {
    /**
     * "allow-modals" : For being able to print emails
     *
     * "allow-scripts" : allows react portals to execute correctly in Safari
     *
     * "allow-popups-to-escape-sandbox" allows to open links in non modal sandboxed mode
     */
    const sandboxAttributes: string = [
        'allow-same-origin',
        'allow-popups',
        'allow-popups-to-escape-sandbox',
        ...(isPrint ? ['allow-modals'] : []),
        ...(isSafari() ? ['allow-scripts'] : []),
    ].join(' ');

    return sandboxAttributes;
};

export default getIframeSandboxAttributes;

--- 
+++ 
@@ -2,11 +2,23 @@
 
 const getIframeSandboxAttributes = (isPrint: boolean) => {
     /**
-     * "allow-modals" : For being able to print emails
+     * "allow-same-origin"
+     *      Because iframe origin is set to protonmail.com we need
+     *      to be able to access it's origin
+     * "allow-modals"
+     *      Allow to be able to print emails
+     * "allow-scripts"
+     *      allows react portals to execute correctly in Safari
+     * "allow-popups"
+     *      allows target="_blank" links to work
+     * "allow-popups-to-escape-sandbox"
+     *      allows to open links in non sandboxed mode
+     *      for ex : if allow-scripts is not present opened links are allowed to execute scripts
      *
-     * "allow-scripts" : allows react portals to execute correctly in Safari
-     *
-     * "allow-popups-to-escape-sandbox" allows to open links in non modal sandboxed mode
+     * ATM we do not need to allow the following options
+     * - allow-forms
+     * - allow-pointer-lock
+     * - allow-top-navigation
      */
     const sandboxAttributes: string = [
         'allow-same-origin',
Add documentation about sandbox attribute
