Merge pull request #13050 from electron/3.0.0-deprecations

chore: removal of 3.0.0 deprecations
This commit is contained in:
Charles Kerr 2018-05-30 09:25:36 +02:00 committed by GitHub
commit b89fe86fa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 76 additions and 421 deletions

View file

@ -31,7 +31,7 @@ const {
warnAboutDisabledWebSecurity,
warnAboutInsecureContentAllowed,
warnAboutExperimentalFeatures,
warnAboutBlinkFeatures,
warnAboutEnableBlinkFeatures,
warnAboutInsecureResources,
warnAboutInsecureCSP,
warnAboutAllowedPopups,
@ -177,7 +177,7 @@ window.addEventListener('load', function loadHandler () {
warnAboutInsecureResources()
warnAboutInsecureContentAllowed()
warnAboutExperimentalFeatures()
warnAboutBlinkFeatures()
warnAboutEnableBlinkFeatures()
warnAboutInsecureCSP()
warnAboutAllowedPopups()
}

View file

@ -91,9 +91,9 @@ const getWebPreferences = function () {
}
}
const moreInformation = '\nFor more information and help, consult ' +
'https://electronjs.org/docs/tutorial/security.\n' +
'This warning will not show up once the app is packaged.'
const moreInformation = `\nFor more information and help, consult
https://electronjs.org/docs/tutorial/security.\n This warning will not show up
once the app is packaged.`
module.exports = {
shouldLogSecurityWarnings,
@ -119,11 +119,10 @@ module.exports = {
return
}
let warning = 'This renderer process loads resources using insecure protocols. ' +
'This exposes users of this app to unnecessary security risks. ' +
'Consider loading the following resources over HTTPS or FTPS. \n' +
resources + '\n' +
moreInformation
const warning = `This renderer process loads resources using insecure
protocols.This exposes users of this app to unnecessary security risks.
Consider loading the following resources over HTTPS or FTPS. \n ${resources}
\n ${moreInformation}`
console.warn('%cElectron Security Warning (Insecure Resources)',
'font-weight: bold;', warning)
@ -137,10 +136,9 @@ module.exports = {
*/
warnAboutNodeWithRemoteContent: () => {
if (getIsRemoteProtocol()) {
let warning = 'This renderer process has Node.js integration enabled ' +
'and attempted to load remote content. This exposes users of this app to severe ' +
'security risks.\n' +
moreInformation
const warning = `This renderer process has Node.js integration enabled
and attempted to load remote content. This exposes users of this app to
severe security risks.\n ${moreInformation}`
console.warn('%cElectron Security Warning (Node.js Integration with Remote Content)',
'font-weight: bold;', warning)
@ -162,9 +160,8 @@ module.exports = {
const webPreferences = getWebPreferences()
if (!webPreferences || webPreferences.webSecurity !== false) return
let warning = 'This renderer process has "webSecurity" disabled. ' +
'This exposes users of this app to severe security risks.\n' +
moreInformation
const warning = `This renderer process has "webSecurity" disabled. This
exposes users of this app to severe security risks.\n ${moreInformation}`
console.warn('%cElectron Security Warning (Disabled webSecurity)',
'font-weight: bold;', warning)
@ -180,10 +177,9 @@ module.exports = {
*/
warnAboutInsecureCSP: () => {
if (isUnsafeEvalEnabled()) {
let warning = 'This renderer process has either no Content Security Policy set ' +
'or a policy with "unsafe-eval" enabled. This exposes users of this ' +
'app to unnecessary security risks.\n' +
moreInformation
const warning = `This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.\n ${moreInformation}`
console.warn('%cElectron Security Warning (Insecure Content-Security-Policy)',
'font-weight: bold;', warning)
@ -199,9 +195,9 @@ module.exports = {
const webPreferences = getWebPreferences()
if (!webPreferences || !webPreferences.allowRunningInsecureContent) return
let warning = 'This renderer process has "allowRunningInsecureContent" ' +
'enabled. This exposes users of this app to severe security risks.\n' +
moreInformation
const warning = `This renderer process has "allowRunningInsecureContent"
enabled. This exposes users of this app to severe security risks.\n
${moreInformation}`
console.warn('%cElectron Security Warning (allowRunningInsecureContent)',
'font-weight: bold;', warning)
@ -219,33 +215,32 @@ module.exports = {
return
}
let warning = 'This renderer process has "experimentalFeatures" ' +
'enabled. This exposes users of this app to some security risk. ' +
'If you do not need this feature, you should disable it.\n' +
moreInformation
const warning = `This renderer process has "experimentalFeatures" enabled.
This exposes users of this app to some security risk. If you do not need
this feature, you should disable it.\n ${moreInformation}`
console.warn('%cElectron Security Warning (experimentalFeatures)',
'font-weight: bold;', warning)
},
/**
* #10 on the checklist: Do not use blinkFeatures
* #10 on the checklist: Do not use enableBlinkFeatures
*
* Logs a warning message about blinkFeatures
* Logs a warning message about enableBlinkFeatures
*/
warnAboutBlinkFeatures: () => {
warnAboutEnableBlinkFeatures: () => {
const webPreferences = getWebPreferences()
if (!webPreferences || !webPreferences.blinkFeatures ||
(webPreferences.blinkFeatures.length && webPreferences.blinkFeatures.length === 0)) {
if (webPreferences === null ||
!webPreferences.hasOwnProperty('enableBlinkFeatures') ||
webPreferences.enableBlinkFeatures.length === 0) {
return
}
let warning = 'This renderer process has additional "blinkFeatures" ' +
'enabled. This exposes users of this app to some security risk. ' +
'If you do not need this feature, you should disable it.\n' +
moreInformation
const warning = `This renderer process has additional "enableBlinkFeatures"
enabled. This exposes users of this app to some security risk. If you do not
need this feature, you should disable it.\n ${moreInformation}`
console.warn('%cElectron Security Warning (blinkFeatures)',
console.warn('%cElectron Security Warning (enableBlinkFeatures)',
'font-weight: bold;', warning)
},
@ -262,10 +257,10 @@ module.exports = {
return
}
let warning = 'A <webview> has "allowpopups" set to true. ' +
'This exposes users of this app to some security risk, since popups are just ' +
'BrowserWindows. If you do not need this feature, you should disable it.\n' +
moreInformation
const warning = `A <webview> has "allowpopups" set to true. This exposes
users of this app to some security risk, since popups are just
BrowserWindows. If you do not need this feature, you should disable it.\n
${moreInformation}`
console.warn('%cElectron Security Warning (allowpopups)',
'font-weight: bold;', warning)