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

Commit

Permalink
Merge pull request #4150 from brave/53.0.2785.116
Browse files Browse the repository at this point in the history
ignore ERR_CERTIFICATE_TRANSPARENCY_REQUIRED until https://github.com…
  • Loading branch information
bbondy authored Sep 21, 2016
2 parents 7352955 + d5f1c55 commit dfe352c
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 dfe352c

Please sign in to comment.