mirror of
https://github.com/Floriansylvain/compact-portfolio.git
synced 2026-10-19 01:24:11 +02:00
feat: update CSP to remove 'unsafe-inline' and restrict img-src
This commit is contained in:
1 parent
eb9f85ead0
commit
0a27f3cc8d
1 file changed
+1
-4
@@ -54,9 +54,6 @@ function generateCSP() {
|
|||||||
if (scriptSources.length > 0) {
|
if (scriptSources.length > 0) {
|
||||||
scriptSrc += ` ${scriptSources.join(" ")}`;
|
scriptSrc += ` ${scriptSources.join(" ")}`;
|
||||||
}
|
}
|
||||||
if (scriptSources.length === 0) {
|
|
||||||
scriptSrc += " 'unsafe-inline'";
|
|
||||||
}
|
|
||||||
|
|
||||||
let styleSrc = "'self'";
|
let styleSrc = "'self'";
|
||||||
if (styleSources.length > 0) {
|
if (styleSources.length > 0) {
|
||||||
@@ -70,7 +67,7 @@ function generateCSP() {
|
|||||||
"default-src 'self'",
|
"default-src 'self'",
|
||||||
`script-src ${scriptSrc}`,
|
`script-src ${scriptSrc}`,
|
||||||
`style-src ${styleSrc}`,
|
`style-src ${styleSrc}`,
|
||||||
"img-src 'self' data: https:",
|
"img-src 'self' https:",
|
||||||
"font-src 'self'",
|
"font-src 'self'",
|
||||||
"connect-src 'self'",
|
"connect-src 'self'",
|
||||||
"media-src 'self'",
|
"media-src 'self'",
|
||||||
|
|||||||
Reference in new issue
Block a user