-
Notifications
You must be signed in to change notification settings - Fork 2
/
csp.js
58 lines (57 loc) · 1.42 KB
/
csp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const policies = {
'default-src': ["'self'"],
'script-src': [
"'self'",
"'unsafe-inline'",
"'unsafe-eval'",
'https://checkout.stripe.com',
'https://js.stripe.com',
'https://maps.googleapis.com',
'https://bctest.dayliff.com:7048',
'https://cybqa.pesapal.com',
'https://pay.google.com',
'https://google.com/pay',
],
'child-src': ["'self'"],
'style-src': [
"'self'",
"'unsafe-inline'",
'https://fonts.googleapis.com',
'http://fonts.googleapis.com/css',
],
'img-src': [
"'self'",
'https://*.stripe.com',
'https://raw.githubusercontent.com',
'https://www.gstatic.com/images/icons/material/system/1x/payment_white_36dp.png',
],
'font-src': ["'self'"],
'frame-src': [
"'self'",
'https://checkout.stripe.com',
'https://js.stripe.com',
'https://hooks.stripe.com',
'https://bctest.dayliff.com:7048',
'https://cybqa.pesapal.com',
'https://pay.google.com',
'https://google.com/pay',
],
'connect-src': [
"'self'",
'https://checkout.stripe.com',
'https://api.stripe.com',
'https://maps.googleapis.com',
'https://bctest.dayliff.com:7048',
'https://cybqa.pesapal.com',
'https://pay.google.com',
'https://google.com/pay',
],
}
module.exports = Object.entries(policies)
.map(([key, value]) => {
if (Array.isArray(value)) {
return `${key} ${value.join(' ')}`
}
return ''
})
.join('; ')