feat(security-headers): extend CSP for third-party integrations#243
feat(security-headers): extend CSP for third-party integrations#243IhorMasechko merged 4 commits intomainfrom
Conversation
Allow reCAPTCHA, GTM inline scripts (hashes), LinkedIn Insight, GA, Hotjar, and Facebook Pixel. Add data: for inline fonts (Swiper).
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughAdds an Apostrophe CMS module that extends 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Vulnerabilities of
|
| digest | sha256:c15c8b2adc1346f62dad392a972070f4a15357014c7637d8341481236708ed57 |
| vulnerabilities | |
| platform | linux/amd64 |
| size | 175 MB |
| packages | 986 |
📦 Base Image node:23-alpine
| also known as |
|
| digest | sha256:b9d38d589853406ff0d4364f21969840c3e0397087643aef8eede40edbb6c7cd |
| vulnerabilities |
Description
Description
Description
Description
Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@website/modules/`@apostrophecms/security-headers/index.js:
- Around line 33-36: In the security headers object for the linkedin entry,
remove the invalid HOSTS token from the connect-src value and replace the string
"HOSTS px.ads.linkedin.com" with "px.ads.linkedin.com" so the linkedin object's
'connect-src' directive only lists the explicit host; update the linkedin key's
connect-src property accordingly.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@website/modules/`@apostrophecms/security-headers/index.js:
- Around line 38-39: The Content-Security-Policy entry for the 'connect-src'
directive in index.js currently includes the literal "localhost", which is
unsafe for production; remove "localhost" from the string or gate it behind an
environment check (e.g., only append "localhost" when NODE_ENV==='development'
or a similar config flag) so that the connect-src value used by the
'connect-src' key does not allow local origins in production.
- Around line 45-47: Update the hotjar CSP entry in the hotjar object so it
includes all required directives: change script-src to include both
https://static.hotjar.com and https://script.hotjar.com plus 'unsafe-inline',
and add connect-src (https://*.hotjar.com https://*.hotjar.io
wss://*.hotjar.com), img-src (https://static.hotjar.com
https://script.hotjar.com https://survey-images.hotjar.com), font-src
(https://script.hotjar.com), and style-src (https://static.hotjar.com
https://script.hotjar.com 'unsafe-inline'). Locate and modify the hotjar object
in the exported security headers (hotjar) to include these keys and values so
Hotjar can load scripts, styles, fonts, images and websocket/XHR beacons
properly.
- Around line 48-50: Update the facebook CSP entry to include the missing
directives required by Facebook Pixel: add a 'connect-src' directive with value
'https://www.facebook.com' and an 'img-src' directive with value
'https://www.facebook.com' alongside the existing 'script-src' =>
'connect.facebook.net' in the facebook object so that beacon requests and the
noscript tracking pixel are allowed.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@website/modules/`@apostrophecms/security-headers/index.js:
- Around line 3-7: The CSP currently builds connectSrcHosts using 'localhost'
via the localhostPart variable when !isProduction, which only matches default
ports; change the localhost entry to 'localhost:*' so dev connections on
non-default ports are allowed—update localhostPart (used in connectSrcHosts) to
include 'localhost:*' instead of 'localhost' and ensure connectSrcHosts still
composes the final string with `'self'`, the modified localhostPart, and the
existing hostnames (d3qlcaacmmrges.cloudfront.net and px.ads.linkedin.com).
Allow reCAPTCHA, GTM inline scripts (hashes), LinkedIn Insight, GA, Hotjar, and Facebook Pixel. Add data: for inline fonts (Swiper).
Extend Apostrophe security-headers CSP to allow third‑party integrations and necessary inline resources. Adds policies enabling reCAPTCHA, Google Tag Manager inline scripts via SHA‑256 hashes, LinkedIn Insight (including localhost in non‑prod), Google Analytics, Hotjar, and Facebook Pixel, and permits data: for inline fonts (Swiper). Policies specify script-src, connect-src, img-src, font-src, and style-src as needed.