Skip to content

Commit

Permalink
Merge pull request #77 from rmpel/master
Browse files Browse the repository at this point in the history
Prevent duplicated entries in policies
  • Loading branch information
paragonie-security authored May 8, 2024
2 parents fa924eb + 06624d7 commit c3e794e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/CSPBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ protected function compileSubgroup(string $directive, $policies = []): string
if (!empty($policies['allow'])) {
/** @var array<array-key, string> $allowedPolicies */
$allowedPolicies = $policies['allow'];
foreach ($allowedPolicies as $url) {
foreach (array_unique($allowedPolicies) as $url) {
/** @var string|bool $url */
$url = filter_var($url, FILTER_SANITIZE_URL);
if (is_string($url)) {
Expand Down

0 comments on commit c3e794e

Please sign in to comment.