@botfabrik/engine-webclient 4.109.12-alpha.2 → 4.109.12-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +14 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -55,7 +55,10 @@ export default (clientName, environment, props) => async (bot) => {
55
55
  directives: {
56
56
  defaultSrc: ["'self'"],
57
57
  scriptSrc: ["'self'"],
58
- styleSrc: ["'self'", "'unsafe-inline'"],
58
+ // stylesheets from trusted resource origins are allowed (e.g. Google Fonts CSS)
59
+ styleSrc: trustedResourceOrigins === undefined
60
+ ? ["'self'", "'unsafe-inline'"]
61
+ : ["'self'", "'unsafe-inline'", ...trustedResourceOrigins],
59
62
  // images: restrict to trusted resource origins when defined, otherwise allow all HTTPS
60
63
  imgSrc: trustedResourceOrigins === undefined
61
64
  ? ["'self'", 'data:', 'https:']
@@ -76,9 +79,16 @@ export default (clientName, environment, props) => async (bot) => {
76
79
  ? ['*']
77
80
  : ["'self'", ...allowedOrigins],
78
81
  // frame-src controls what this page may embed in an iframe.
79
- // The /embed page loads the chatbot in an iframe on the same server ('self').
80
- // When allowedOrigins are set, those must also be allowed (e.g. standalone view).
81
- frameSrc: ["'self'", ...(allowedOrigins ?? [])],
82
+ // The /embed page loads the chatbot in an iframe on the same server.
83
+ // We include both http and https of the server's base URL because a browser
84
+ // with a cached HSTS policy for localhost may load the iframe via https://
85
+ // even when the embed page was served via http://.
86
+ frameSrc: [
87
+ "'self'",
88
+ bot.webserver.baseUrl,
89
+ bot.webserver.baseUrl.replace(/^http:/, 'https:'),
90
+ ...(allowedOrigins ?? []),
91
+ ],
82
92
  objectSrc: ["'none'"], // disable Flash/plugins
83
93
  baseUri: ["'self'"], // prevent <base>-tag injection
84
94
  // When SAML auth is configured, the browser POSTs a form to the external IdP.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botfabrik/engine-webclient",
3
- "version": "4.109.12-alpha.2",
3
+ "version": "4.109.12-alpha.3",
4
4
  "description": "Webclient for Botfabriks Bot Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -53,5 +53,5 @@
53
53
  "tsx": "^4.21.0",
54
54
  "typescript": "5.9.3"
55
55
  },
56
- "gitHead": "0706d247f9232a5a70742a082e0f3177ed182609"
56
+ "gitHead": "5b7e98b937eff8de52f6f10e180b49868b949860"
57
57
  }