This repository was archived by the owner on Jul 29, 2022. It is now read-only.
Implement Electron Security Guidelines#278
Merged
Merged
Conversation
amaury1093
reviewed
Apr 18, 2019
amaury1093
reviewed
Apr 29, 2019
Contributor
amaury1093
left a comment
There was a problem hiding this comment.
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?
amaury1093
reviewed
Apr 29, 2019
| // 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:` |
Contributor
There was a problem hiding this comment.
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:` |
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resources:
https://electronjs.org/docs/tutorial/security
https://speakerdeck.com/masatokinugawa/electron-abusing-the-lack-of-context-isolation-curecon-en?slide=13
fix: Relates to #124. Security openethereum/fether#451
- set webPreferences and env variables in accordance with the official Electron security checklist.
- set a content security policy
- update package README with some rationale
- run doyensec's electronegativity for further potential vulnerabilities
#220