Skip to content
This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Implement Electron Security Guidelines#278

Merged
amaury1093 merged 15 commits into
masterfrom
yj-security
Apr 30, 2019
Merged

Implement Electron Security Guidelines#278
amaury1093 merged 15 commits into
masterfrom
yj-security

Conversation

@pmespresso
Copy link
Copy Markdown
Contributor

@pmespresso pmespresso commented Apr 17, 2019

Resources:

#220

Comment thread packages/electron-app/README.md Outdated
@pmespresso pmespresso marked this pull request as ready for review April 23, 2019 12:39
Copy link
Copy Markdown
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Small comments below.

I also got

Refused to load the stylesheet 'https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' file: blob:".

But have no idea who is asking for this font. Maybe SUI? In this case we should add https in style-src.

@yjkimjunior Could you merge/rebase master too?

Comment thread packages/electron-app/src/main/index.ts Outdated
Comment thread packages/electron-app/src/main/index.ts Outdated
Comment thread packages/electron-app/src/main/util/csp.ts Outdated
// Disallow everything as fallback by default for all CSP fetch directives.
defaultSrc: "default-src 'none';",
// Disallow fonts.
fontSrc: "font-src 'self';", // Additionally used in Parity-JS Shell `'self' data: https:`
Copy link
Copy Markdown
Contributor

@amaury1093 amaury1093 Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new one, now it's

Refused to load the font 'data:application/x-font-ttf;charset=utf-8;;base64,AAEAAAAOAIAAAwBgT1MvMj3hSQEAAADsAAAAVmNtYXDQEhm3AAABRAAAAUpjdnQgBkn/lAAABuwAAAAcZnBnbYoKeDsAAAcIAAAJkWdhc3AAAAAQAAAG5AAAAAhnbHlm32cEdgAAApAAAAC2aGVhZAErPHsAAANIAAAANmhoZWEHUwNNAAADgAAAACRobXR4CykAAAAAA6QAAAAMbG9jYQA4AFsAAAOwAAAACG1heHAApgm8AAADuAAAACBuYW1lzJ0aHAAAA9gAAALNcG9zdK69QJgAAAaoAAAAO3ByZXCSoZr/AAAQnAAAAFYAAQO4AZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA6ADoAQNS/2oAWgMLAE8AAAABAAAAAAAAAAAAAwAAAAMAAAAcAAEAAAAAAEQAA...BSLLIAATsrLbBTLLIBADsrLbBULLIBATsrLbBVLLIAAD4rLbBWLLIAAT4rLbBXLLIBAD4rLbBYLLIBAT4rLbBZLLIAADorLbBaLLIAATorLbBbLLIBADorLbBcLLIBATorLbBdLLAyKy6xJgEUKy2wXiywMiuwNistsF8ssDIrsDcrLbBgLLAAFrAyK7A4Ky2wYSywMysusSYBFCstsGIssDMrsDYrLbBjLLAzK7A3Ky2wZCywMyuwOCstsGUssDQrLrEmARQrLbBmLLA0K7A2Ky2wZyywNCuwNystsGgssDQrsDgrLbBpLLA1Ky6xJgEUKy2waiywNSuwNistsGsssDUrsDcrLbBsLLA1K7A4Ky2wbSwrsAhlsAMkUHiwARUwLQAAAEu4AMhSWLEBAY5ZuQgACABjILABI0SwAyNwsgQoCUVSRLIKAgcqsQYBRLEkAYhRWLBAiFixBgNEsSYBiFFYuAQAiFixBgFEWVlZWbgB/4WwBI2xBQBEAAA=' because it violates the following Content Security Policy directive: "font-src 'self'".

so font-src 'self' data:;

: "script-src file: 'unsafe-inline';",
styleSrc: !IS_PROD
? "style-src 'self' 'unsafe-inline' file: blob:;" // Additionally used in Parity-JS Shell `data: https:`
: "style-src unsafe-inline' file: blob:;", // Additionally used in Parity-JS Shell `data: https:`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refused to load the stylesheet 'https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' file: blob:".

Add https in both. Actually tbh I don't think there's need to differentiate between IS_PROD or not here.

* fix(csp): Make CSP work

* fix: Remove unsafe-eval
Copy link
Copy Markdown
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@amaury1093 amaury1093 merged commit d58406c into master Apr 30, 2019
@amaury1093 amaury1093 deleted the yj-security branch April 30, 2019 10:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants