Skip to content

Commit 112bc97

Browse files
committed
Use standalone switch for CSP
1 parent f8a53ef commit 112bc97

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

plugins/help/help.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function action()
7878
'tablink' => [$this, 'tablink'],
7979
]);
8080

81-
$rcmail->output->set_env('safemode', true);
81+
$rcmail->output->csp_allow_remote_ressources = true;
8282
$rcmail->output->set_env('help_links', $this->help_metadata());
8383
$rcmail->output->send(!empty($_GET['_content']) ? 'help.content' : 'help.help');
8484
}

program/actions/mail/compose.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ public static function prepare_message_body()
683683
// We can't depend the "safemode" on the message being HTML or not
684684
// because the user might want to change the editor after loading the
685685
// page, and then add remote ressources.
686-
$rcmail->output->set_env('safemode', true);
686+
$rcmail->output->csp_allow_remote_ressources = true;
687687

688688
return $body;
689689
}

program/actions/settings/identity_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function run($args = [])
7575
$rcmail->output->send('identityadd');
7676
}
7777

78-
$rcmail->output->set_env('safemode', true);
78+
$rcmail->output->csp_allow_remote_ressources = true;
7979
$rcmail->output->send('identityedit');
8080
}
8181

program/actions/settings/response_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function run($args = [])
4646

4747
$rcmail->output->set_pagetitle($title);
4848
$rcmail->output->set_env('readonly', !empty(self::$response['static']));
49-
$rcmail->output->set_env('safemode', true);
49+
$rcmail->output->csp_allow_remote_ressources = true;
5050
$rcmail->output->add_handler('responseform', [$this, 'response_form']);
5151
$rcmail->output->send('responseedit');
5252
}

program/include/rcmail_output_html.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
class rcmail_output_html extends rcmail_output
2424
{
2525
public $type = 'html';
26+
public $csp_allow_remote_ressources = false;
2627

2728
protected $message;
2829
protected $template_name;
@@ -2729,7 +2730,7 @@ protected function add_csp_header(): void
27292730
$csp = $this->get_csp_value('content_security_policy');
27302731
if ($csp !== false) {
27312732
$csp_parts = [$csp];
2732-
if (isset($this->env['safemode']) && $this->env['safemode'] === true) {
2733+
if ($this->csp_allow_remote_ressources || (isset($this->env['safemode']) && $this->env['safemode'] === true)) {
27332734
$csp_allow_remote = $this->get_csp_value('content_security_policy_add_allow_remote');
27342735
if ($csp_allow_remote !== false) {
27352736
$csp_parts[] = $csp_allow_remote;

0 commit comments

Comments
 (0)