Skip to content

Commit f621c62

Browse files
committed
Update csp handling
1 parent 977acff commit f621c62

3 files changed

Lines changed: 33 additions & 26 deletions

File tree

Build/Scripts/runTests.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ restoreComposerFiles() {
151151

152152
loadHelp() {
153153
# Load help text into $HELP
154-
read -r -d '' HELP <<EOF
154+
read -r -d '' HELP <<'EOF'
155155
TYPO3 core test runner. Execute unit, functional and other test suites in
156156
a container based test environment. Handles execution of single test files,
157157
sending xdebug information to a local IDE and more.
@@ -563,7 +563,11 @@ case ${TEST_SUITE} in
563563
SUITE_EXIT_CODE=$?
564564
;;
565565
postgres)
566-
${CONTAINER_BIN} run --rm ${CI_PARAMS} --name postgres-func-${SUFFIX} --network ${NETWORK} -d -e POSTGRES_PASSWORD=funcp -e POSTGRES_USER=funcu --tmpfs /var/lib/postgresql/data:rw,noexec,nosuid ${IMAGE_POSTGRES} >/dev/null
566+
POSTGRES_TMPFS="/var/lib/postgresql/data"
567+
if [[ ${DBMS_VERSION} -eq 18 ]]; then
568+
POSTGRES_TMPFS="/var/lib/postgresql"
569+
fi
570+
${CONTAINER_BIN} run --rm ${CI_PARAMS} --name postgres-func-${SUFFIX} --network ${NETWORK} -d -e POSTGRES_PASSWORD=funcp -e POSTGRES_USER=funcu --tmpfs ${POSTGRES_TMPFS}:rw,noexec,nosuid ${IMAGE_POSTGRES} >/dev/null
567571
waitFor postgres-func-${SUFFIX} 5432
568572
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_pgsql -e typo3DatabaseName=bamboo -e typo3DatabaseUsername=funcu -e typo3DatabaseHost=postgres-func-${SUFFIX} -e typo3DatabasePassword=funcp"
569573
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name functional-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"

Configuration/ContentSecurityPolicies.php

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,30 @@
1111
use TYPO3\CMS\Core\Security\ContentSecurityPolicy\UriValue;
1212
use TYPO3\CMS\Core\Type\Map;
1313

14-
return Map::fromEntries([
15-
Scope::backend(),
16-
17-
new MutationCollection(
18-
// The csp extension is required for images in the PreviewRenderer when active
19-
new Mutation(
20-
MutationMode::Extend,
21-
Directive::ImgSrc,
22-
SourceScheme::data,
23-
new UriValue('*.sndcdn.com'),
24-
),
25-
// The csp extension is required for the IFrame in the info window
26-
new Mutation(
27-
MutationMode::Extend,
28-
Directive::FrameSrc,
29-
SourceScheme::data,
30-
new UriValue('*.soundcloud.com'),
31-
),
14+
$mutationCollection = new MutationCollection(
15+
// The csp extension is required for images in the PreviewRenderer when active
16+
new Mutation(
17+
MutationMode::Extend,
18+
Directive::ImgSrc,
19+
SourceScheme::data,
20+
new UriValue('*.sndcdn.com'),
21+
),
22+
// The csp extension is required for the IFrame in the info window
23+
new Mutation(
24+
MutationMode::Extend,
25+
Directive::FrameSrc,
26+
SourceScheme::data,
27+
new UriValue('*.soundcloud.com'),
3228
),
33-
]);
29+
);
30+
31+
return Map::fromEntries(
32+
[
33+
Scope::frontend(),
34+
$mutationCollection
35+
],
36+
[
37+
Scope::backend(),
38+
$mutationCollection
39+
]
40+
);

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ TBD EventListener
8686

8787
### 3.3 Content security policy
8888

89-
If CSP is activated in the backend, policies will be automatically added.
90-
To do this, the file Configuration/ContentSecurityPolicies.php is used.
91-
92-
If CSP is to be extended for the frontend, the configuration can be added
93-
in a site package extension or in the global csp.yml
89+
By default, CSP settings are added for the frontend and backend. These settings can be modified via YAML or events.
9490

9591
Take a look at the current documentation:
9692
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentSecurityPolicy/Index.html

0 commit comments

Comments
 (0)