CSP in documentation

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
heural
Posts: 85
Joined: 09 Jun 2022, 07:55

CSP in documentation

Post by heural » 07 Apr 2025, 08:41

Hi Aimeos-Team,

is the docu for setting header in Typo3 for Content-Secuirty-Policy a alternate syntax or wrong?
https://aimeos.org/docs/2024.x/typo3/optimize/

The Typo3-docu says here this is a indexed array not a single string for that:
https://docs.typo3.org/m/typo3/referenc ... nalheaders

I think that

Code: Select all

config.additionalHeaders = Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'
  | X-Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'
  | X-Webkit-CSP: default-src 'self'; style-src 'self' 'unsafe-inline'
has no effect and therefore no CSP-headers are send.

I changed to the array-like style and now many of our external scripts and images (e.g. src ="data:") are blocked by browsers and should the expected behavior for CSP blocking.

So I think it should be:

Code: Select all

config.additionalHeaders {
  110.header = Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'
  120.header = X-Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'
  130.header =  X-Webkit-CSP: default-src 'self'; style-src 'self' 'unsafe-inline'
}
Thank you!
Last edited by heural on 07 Apr 2025, 13:47, edited 2 times in total.
Thanks a lot!

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: CSP in documentation

Post by aimeos » 08 Apr 2025, 09:16

The browser specific headers shouldn't be necessary any more. Does that also work?

Code: Select all

config.additionalHeaders {
  110 = Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply