Skip to content

Commit 0fd6204

Browse files
authored
Merge pull request #401 from sparcs-kaist/hotfix/channel-csp
Fix prod ChannelTalk errors
2 parents c684041 + 8141597 commit 0fd6204

File tree

2 files changed

+25
-24
lines changed

2 files changed

+25
-24
lines changed

nginx/nginx-production.conf

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,35 @@ server {
55
server_name _;
66

77
location / {
8-
set $CSP "default-src 'self' 'unsafe-inline' newara.sparcs.org blob: "; # Default rules for new-ara
9-
set $CSP "${CSP}*.googleapis.com *.gstatic.com https://www.google-analytics.com "; # Default rules for google fonts, google analytics
10-
set $CSP "${CSP}https://analytics.google.com; "; # Default rules for google analytics
11-
set $CSP "${CSP}object-src 'self'; "; # Disallow Objects
8+
# See this link for more information about CSP
9+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
10+
# https://content-security-policy.com/
11+
set $CSP "default-src 'self' 'unsafe-inline' newara.sparcs.org "; # Default rules for new-ara
12+
set $CSP "${CSP}*.channel.io *.cdninstagram.com "; # Default rules for channeltalk
13+
set $CSP "${CSP}blob: *.googleapis.com *.gstatic.com "; # Default rules for google fonts, google analytics
14+
set $CSP "${CSP}https://www.google-analytics.com https://analytics.google.com; "; # Default rules for google analytics
15+
16+
set $CSP "${CSP}object-src 'self'; "; # Disallow Objects
17+
set $CSP "${CSP}connect-src 'self' *.channel.io *.sentry.io wss://*.channel.io "; # Connect rules for channeltalk (1/2)
18+
set $CSP "${CSP}wss://*.desk-ws.channel.io wss://*.front-ws.channel.io "; # Connect rules for channeltalk (2/2)
19+
set $CSP "${CSP}https://www.google-analytics.com https://analytics.google.com; "; # Connect rules for google analytics
20+
1221
set $CSP "${CSP}img-src * data: blob:; "; # Image rules for new-ara (allow all, data, blobs)
22+
1323
set $CSP "${CSP}script-src 'self' "; # Script rules for new-ara
24+
set $CSP "${CSP}*.channel.io *.sentry-cdn.com "; # Script rules for channeltalk
1425
set $CSP "${CSP}*.googleapis.com https://www.google-analytics.com "; # Script rules for google analytics (1/3)
1526
set $CSP "${CSP}https://ssl.google-analytics.com https://www.googletagmanager.com "; # Script rules for google analytics (2/3)
16-
set $CSP "${CSP}'sha512-e/cuSC5V9VDB1AUGqvPz2BwaJ2W83fduZ4RZjXHMtjQrLS0j06MAtFP//Iz9EL55MSm7SNBtyFYlDkmxdif/jg=='";
27+
set $CSP "${CSP}'sha512-e/cuSC5V9VDB1AUGqvPz2BwaJ2W83fduZ4RZjXHMtjQrLS0j06MAtFP//Iz9EL55MSm7SNBtyFYlDkmxdif/jg=='; ";
1728
# Script rules for google analytics (3/3)
1829
# > From our inline script in index.html
19-
set $CSP "${CSP}https://cdn.channel.io;"; # Script rules for channel
2030

2131
add_header Content-Security-Policy $CSP always;
2232
add_header X-Content-Type-Options nosniff;
2333
add_header X-Frame-Options DENY;
2434
add_header X-XSS-Protection "1; mode=block";
35+
add_header Strict-Transport-Security "max-age=31536000";
36+
add_header Referrer-Policy "origin";
2537

2638
root /usr/share/nginx/newara;
2739
try_files $uri $uri/ /index.html;

src/components/TheFooter.vue

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ export default {
6565
TermsPopup
6666
},
6767
68-
data () {
69-
return {
70-
isChannelOpen: false
71-
}
72-
},
73-
7468
computed: {
7569
agreeTosAt () {
7670
return this.$store.state.auth.userProfile?.agree_terms_of_service_at
@@ -79,18 +73,13 @@ export default {
7973
8074
methods: {
8175
openChannelService () {
82-
this.isChannelOpen = !this.isChannelOpen
83-
if (this.isChannelOpen) {
84-
ChannelService.updateUser({
85-
profile: {
86-
name: this.$store.state.auth.userProfile?.nickname,
87-
email: this.$store.state.auth.userProfile?.email
88-
}
89-
})
90-
ChannelService.showMessenger()
91-
} else {
92-
ChannelService.hideMessenger()
93-
}
76+
ChannelService.updateUser({
77+
profile: {
78+
name: this.$store.state.auth.userProfile?.nickname,
79+
email: this.$store.state.auth.userProfile?.email
80+
}
81+
})
82+
ChannelService.showMessenger()
9483
}
9584
}
9685
}

0 commit comments

Comments
 (0)