Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/system/httpheaders/httpheaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ private function compileAutomaticCspHeaderRules(): array
}

// Append the script hashes placeholder
if ($scriptHashesEnabled && strpos($cspValue->directive, 'script-src') === 0)
if ($scriptHashesEnabled && strpos($row->directive, 'script-src') === 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is supposed to be $cspHeaderValue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have to adjust the following line for a better name. https://github.com/joomla/joomla-cms/pull/27835/files#diff-0ea3df9101b205d7c283ccf8ef68d621L359

@wilsonge no it is not. It runs to the following errors when I change it to $cspHeaderValue.
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($scriptHashesEnabled && strpos($row->directive, 'script-src') === 0)
if ($scriptHashesEnabled && strpos($cspHeaderkey, 'script-src') === 0)

{
$cspHeaderValue = '{script-hashes} ' . $cspHeaderValue;
}

// Append the style hashes placeholder
if ($styleHashesEnabled && strpos($cspValue->directive, 'style-src') === 0)
if ($styleHashesEnabled && strpos($row->directive, 'style-src') === 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($styleHashesEnabled && strpos($row->directive, 'style-src') === 0)
if ($styleHashesEnabled && strpos($cspHeaderkey, 'style-src') === 0)

{
$cspHeaderValue = '{style-hashes} ' . $cspHeaderValue;
}
Expand Down