mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-26 09:03:48 +08:00
Add CSP frame-ancestors for #537
This commit is contained in:
parent
2daa4f97e2
commit
66fafd3981
1 changed files with 5 additions and 1 deletions
|
@ -19,6 +19,7 @@ class CSP
|
|||
$img = ["'self'", 'data:'],
|
||||
$style = ["'self'", "'unsafe-inline'"],
|
||||
$frame = [],
|
||||
$frame_ancestors = [],
|
||||
|
||||
$report = false,
|
||||
$report_to = [],
|
||||
|
@ -29,7 +30,7 @@ class CSP
|
|||
if ($default) {
|
||||
foreach (\explode(';', $default) as $directive) {
|
||||
$values = \explode(' ', $directive);
|
||||
$name = \preg_replace('/-.+/', '', \trim(\array_shift($values)));
|
||||
$name = \str_replace('-', '_', \preg_replace('/-(src)$/D', '', \trim(\array_shift($values))));
|
||||
$this->$name = \array_unique(\array_merge($this->$name, $values));
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +54,9 @@ class CSP
|
|||
if ($this->frame) {
|
||||
$params[] = 'frame-src ' . \implode(' ', \array_unique($this->frame));
|
||||
}
|
||||
if ($this->frame_ancestors) {
|
||||
$params[] = 'frame-ancestors ' . \implode(' ', \array_unique($this->frame_ancestors));
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
if ($this->report) {
|
||||
|
|
Loading…
Reference in a new issue