-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Explain Content Security Policy modes (#4710)
* [TASK] Explain Content Security Policy modes Related: TYPO3-Documentation/Changelog-To-Doc#390 Releases: main, 12.4 * Update Documentation/ApiOverview/ContentSecurityPolicy/Index.rst Co-authored-by: Stefan Frömken <[email protected]> --------- Co-authored-by: Stefan Frömken <[email protected]>
- Loading branch information
1 parent
7548f94
commit 2107735
Showing
15 changed files
with
524 additions
and
1 deletion.
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
33 changes: 33 additions & 0 deletions
33
Documentation/ApiOverview/ContentSecurityPolicy/_ContentSecurityPolicies_mode_append.php
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceKeyword; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; | ||
use TYPO3\CMS\Core\Type\Map; | ||
|
||
return Map::fromEntries([ | ||
Scope::frontend(), | ||
new MutationCollection( | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceKeyword::self, | ||
), | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::ImgSrc, | ||
new UriValue('example.org'), | ||
), | ||
new Mutation( | ||
MutationMode::Append, | ||
Directive::ImgSrc, | ||
new UriValue('example.com'), | ||
), | ||
), | ||
]); |
28 changes: 28 additions & 0 deletions
28
Documentation/ApiOverview/ContentSecurityPolicy/_ContentSecurityPolicies_mode_extend.php
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceKeyword; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; | ||
use TYPO3\CMS\Core\Type\Map; | ||
|
||
return Map::fromEntries([ | ||
Scope::frontend(), | ||
new MutationCollection( | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceKeyword::self, | ||
), | ||
new Mutation( | ||
MutationMode::Extend, | ||
Directive::ImgSrc, | ||
new UriValue('example.com'), | ||
), | ||
), | ||
]); |
42 changes: 42 additions & 0 deletions
42
...ntation/ApiOverview/ContentSecurityPolicy/_ContentSecurityPolicies_mode_inherit_again.php
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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceKeyword; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceScheme; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; | ||
use TYPO3\CMS\Core\Type\Map; | ||
|
||
return Map::fromEntries([ | ||
Scope::frontend(), | ||
new MutationCollection( | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceKeyword::self, | ||
), | ||
new Mutation( | ||
MutationMode::InheritAgain, | ||
Directive::ImgSrc, | ||
), | ||
new Mutation( | ||
MutationMode::Append, | ||
Directive::ImgSrc, | ||
new UriValue('example.com'), | ||
), | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceScheme::data, | ||
), | ||
new Mutation( | ||
MutationMode::InheritAgain, | ||
Directive::ScriptSrc, | ||
), | ||
), | ||
]); |
42 changes: 42 additions & 0 deletions
42
...entation/ApiOverview/ContentSecurityPolicy/_ContentSecurityPolicies_mode_inherit_once.php
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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceKeyword; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceScheme; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; | ||
use TYPO3\CMS\Core\Type\Map; | ||
|
||
return Map::fromEntries([ | ||
Scope::frontend(), | ||
new MutationCollection( | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceKeyword::self, | ||
), | ||
new Mutation( | ||
MutationMode::InheritOnce, | ||
Directive::ImgSrc, | ||
), | ||
new Mutation( | ||
MutationMode::Append, | ||
Directive::ImgSrc, | ||
new UriValue('example.com'), | ||
), | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::DefaultSrc, | ||
SourceScheme::data, | ||
), | ||
new Mutation( | ||
MutationMode::InheritOnce, | ||
Directive::ImgSrc, | ||
), | ||
), | ||
]); |
31 changes: 31 additions & 0 deletions
31
Documentation/ApiOverview/ContentSecurityPolicy/_ContentSecurityPolicies_mode_reduce.php
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Directive; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Mutation; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationCollection; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\MutationMode; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\Scope; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceKeyword; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\SourceScheme; | ||
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue; | ||
use TYPO3\CMS\Core\Type\Map; | ||
|
||
return Map::fromEntries([ | ||
Scope::frontend(), | ||
new MutationCollection( | ||
new Mutation( | ||
MutationMode::Set, | ||
Directive::ImgSrc, | ||
SourceKeyword::self, | ||
SourceScheme::data, | ||
new UriValue('example.com'), | ||
), | ||
new Mutation( | ||
MutationMode::Reduce, | ||
Directive::ImgSrc, | ||
SourceScheme::data, | ||
), | ||
), | ||
]); |
Oops, something went wrong.