Skip to content

Commit d4a9bb3

Browse files
committed
Add data: URL to CSP and upgrade helmet
Seems like the old version of helmet had a problem with `data:`. This patch upgrades to the latest version and adds the CSP rule to allow Google Fonts and the offline version of it, to properly include the fonts and no longer throw ugly error messages at us. Signed-off-by: Sheogorath <[email protected]>
1 parent d9ba11b commit d4a9bb3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/csp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var defaultDirectives = {
99
// ^ TODO: Remove unsafe-eval - webpack script-loader issues https://github.com/hackmdio/codimd/issues/594
1010
imgSrc: ['*'],
1111
styleSrc: ['\'self\'', '\'unsafe-inline\'', 'https://assets-cdn.github.com'], // unsafe-inline is required for some libs, plus used in views
12-
fontSrc: ['\'self\'', 'https://public.slidesharecdn.com'],
12+
fontSrc: ['\'self\'', 'data:', 'https://public.slidesharecdn.com'],
1313
objectSrc: ['*'], // Chrome PDF viewer treats PDFs as objects :/
1414
mediaSrc: ['*'],
1515
childSrc: ['*'],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"gist-embed": "~2.6.0",
4747
"graceful-fs": "^4.1.11",
4848
"handlebars": "^4.0.6",
49-
"helmet": "^3.3.0",
49+
"helmet": "^3.13.0",
5050
"highlight.js": "~9.12.0",
5151
"i18n": "^0.8.3",
5252
"imgur": "git+https://github.com/hackmdio/node-imgur.git",

0 commit comments

Comments
 (0)