Skip to content

Commit

Permalink
Harden datarecord check
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere authored Jul 21, 2023
1 parent fe9a395 commit 2aa4d5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Extensions/ControllerCSPExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private function addCSPHeaders(mixed $ymlConfig, Controller $owner): void
$legacy = $config['legacy'] ?? true;
$unsafeCSSInline = $config['style-src']['unsafe-inline'];
$unsafeJsInline = $config['script-src']['unsafe-inline'];
if (class_exists('\Page')) {
if (class_exists('\Page') && $owner && $owner->dataRecord) {
$config['style-src']['unsafe-inline'] = $unsafeCSSInline || $owner->dataRecord->AllowCSSInline;
$config['script-src']['unsafe-inline'] = $unsafeJsInline || $owner->dataRecord->AllowJSInline;
}
Expand Down

0 comments on commit 2aa4d5f

Please sign in to comment.