Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
ignore ERR_CERTIFICATE_TRANSPARENCY_REQUIRED until electron-archive/b…
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Sep 21, 2016
1 parent 7352955 commit d5f1c55
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,39 @@ loadAppStatePromise.then((initialState) => {
}
})

const notifyCertError = (webContents, url, error, cert) => {
console.log('notify cert error')
errorCerts[url] = {
subjectName: cert.subjectName,
issuerName: cert.issuerName,
serialNumber: cert.serialNumber,
validStart: cert.validStart,
validExpiry: cert.validExpiry,
fingerprint: cert.fingerprint
}

// Tell the page to show an unlocked icon. Note this is sent to the main
// window webcontents, not the webview webcontents
let sender = webContents.hostWebContents || webContents
sender.send(messages.CERT_ERROR, {
url,
error,
cert,
tabId: webContents.getId()
})
}

app.on('ready', () => {
let sessionStateSaveInterval = null
app.on('certificate-error', (e, webContents, url, error, cert, cb) => {
app.on('certificate-error', (e, webContents, url, error, cert, resourceType, overridable, strictEnforcement, expiredPreviousDecision, cb) => {
// ignore transparency errors for now because we are blocking
// sites that Chrome isn't for some reason (ex: http://www.mint.com)
if (error === 'net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED') {
e.preventDefault()
cb(true)
return
}

let host = urlParse(url).host
if (host && acceptCertDomains[host] === true) {
// Ignore the cert error
Expand All @@ -252,24 +282,12 @@ app.on('ready', () => {
return
}

errorCerts[url] = {
subjectName: cert.subjectName,
issuerName: cert.issuerName,
serialNumber: cert.serialNumber,
validStart: cert.validStart,
validExpiry: cert.validExpiry,
fingerprint: cert.fingerprint
if (resourceType !== 'mainFrame') {
// Block subresources with certificate errors
return
}

// Tell the page to show an unlocked icon. Note this is sent to the main
// window webcontents, not the webview webcontents
let sender = webContents.hostWebContents || webContents
sender.send(messages.CERT_ERROR, {
url,
error,
cert,
tabId: webContents.getId()
})
notifyCertError(webContents, url, error, cert)
})

app.on('window-all-closed', () => {
Expand Down

0 comments on commit d5f1c55

Please sign in to comment.