Skip to content

Commit 622678d

Browse files
authored
Merge pull request #5 from mdarrik/fix-cloudfront-url-glob
Fix url patterns
2 parents c52891e + 7298b0d commit 622678d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ function visitNode(tree) {
9696
sha256Hash.update(node.children[0].value)
9797
hashLists[node.tagName].push(`'sha256-${sha256Hash.digest('base64')}'`)
9898
} else if(node.properties.src) {
99-
hashLists[node.tagName].push(`'${node.properties.src}'`);
99+
hashLists[node.tagName].push(`${node.properties.src}`);
100100
} else if(node.tagName === 'link') {
101-
hashLists.style.push(`'${node.properties.href}'`);
101+
hashLists.style.push(`${node.properties.href}`);
102102
}
103103
})
104104
return hashLists
@@ -117,7 +117,7 @@ const url = filePath.replace(publishPath, '').replace(/^\/index.html/, '/');
117117
return (
118118
`${url} ${reportToHeader === '' ? '' : `
119119
${reportToHeader}`}
120-
Content-Security-Policy: default-src 'self' ${allowCloudfrontSource ? `'https://*.cloudfront.net'` : ''}; script-src 'self' 'strict-dynamic' 'unsafe-inline' ${hashes['script'].join(" ")}; style-src 'self' 'unsafe-inline' ${unsafeInlineStyles ? '' : hashes['style'].join(' ')}; ${ reportUrl == null ? null : `report-to netlify-csp-endpoint; report-uri ${reportUrl};`}
120+
Content-Security-Policy: default-src 'self' ${allowCloudfrontSource ? `https://*.cloudfront.net` : ''}; object-src 'none'; script-src 'self' 'strict-dynamic' 'unsafe-inline' ${hashes['script'].join(" ")}; style-src 'self' 'unsafe-inline' ${unsafeInlineStyles ? '' : hashes['style'].join(' ')}; ${ reportUrl == null ? null : `report-to netlify-csp-endpoint; report-uri ${reportUrl};`}
121121
`)
122122
}
123123
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netlify-plugin-csp-headers",
3-
"version": "0.0.1-alpha.07",
3+
"version": "0.0.1-alpha.08",
44
"main": "index.js",
55
"repository": "https://github.com/mdarrik/netlify-plugin-csp-hash.git",
66
"author": "Darrik <30670444+mdarrik@users.noreply.github.com>",

0 commit comments

Comments
 (0)