generated from silverstripe/silverstripe-module
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from silverstripeltd/feature/gtm-missing-direc…
…tive-updates Google Services fragment updates
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\ContentSecurity\Fragments; | ||
|
||
use Silverstripe\CSP\Directive; | ||
use Silverstripe\CSP\Fragments\Fragment; | ||
use Silverstripe\CSP\Policies\Policy; | ||
|
||
/* | ||
* Allows execution of Google Maps API related resources | ||
* Nonce on the https://maps.google.com/maps/api/js URL is required before using this fragment. | ||
* | ||
* https://content-security-policy.com/examples/google-maps/ | ||
*/ | ||
class GoogleMaps implements Fragment | ||
{ | ||
public static function addTo(Policy $policy): void | ||
{ | ||
$policy | ||
->addDirective(Directive::CONNECT, 'https://maps.googleapis.com') | ||
->addDirective(Directive::IMG, | ||
[ | ||
'https://maps.gstatic.com', | ||
'https://*.googleapis.com', | ||
'https://*.ggpht.com' | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters