Skip to content

Commit

Permalink
feat(CSP): adds hotjar and cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiantela committed Jul 26, 2024
1 parent fc6fdbe commit bf82b6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ http {
set $CSP_DEFAULT "default-src 'self'";
set $CSP_SCRIPT "script-src 'self' 'unsafe-eval' 'unsafe-inline' www.googletagmanager.com *.hotjar.com www.google-analytics.com";
set $CSP_FONT "font-src 'self' fonts.gstatic.com";
set $CSP_STYLE "style-src 'self' 'unsafe-hashes' 'unsafe-inline' ilhasoft.com.br fonts.googleapis.com";
set $CSP_STYLE "style-src 'self' 'unsafe-hashes' 'unsafe-inline' ilhasoft.com.br cdnjs.cloudflare.com fonts.googleapis.com";
set $CSP_IMAGE "img-src 'self' data: www.google-analytics.com www.google.com.br www.googletagmanager.com *.amazonaws.com";
set $CSP_CONNECT "connect-src 'self' *.weni.ai *.bothub.it www.google-analytics.com analytics.google.com *.hotjar.com";
set $CSP_CONNECT "connect-src 'self' *.weni.ai *.bothub.it www.google-analytics.com analytics.google.com *.hotjar.io wss://ws.hotjar.com";
set $CSP_FRAME_ANCESTORS "frame-ancestors 'self' *.weni.ai";

add_header Content-Security-Policy "${CSP_DEFAULT}; ${CSP_SCRIPT}; ${CSP_STYLE}; ${CSP_FONT}; ${CSP_IMAGE}; ${CSP_CONNECT}; ${CSP_FRAME_ANCESTORS};";
Expand Down
20 changes: 12 additions & 8 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
<title>Weni</title>

<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_HOTJAR_ID'),hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
const hotjarId = runtimeVariables.get('VUE_APP_BOTHUB_WEBAPP_HOTJAR_ID');

if (hotjarId) {
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:hotjarId,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
}
</script>
</head>

Expand Down

0 comments on commit bf82b6c

Please sign in to comment.