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

Show passive mixed content as secure #5556

Merged
merged 1 commit into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -995,16 +995,20 @@ class Frame extends ImmutableComponent {
windowActions.setNavigated(this.webview.getURL(), this.props.frameKey, true, this.frame.get('tabId'))
}
}
this.webview.addEventListener('did-change-security', (e) => {
this.webview.addEventListener('security-style-changed', (e) => {
let isSecure = null
let runInsecureContent = false
if (e.securityState === 'secure' || e.securityState === 'warning') {
let runInsecureContent = this.runInsecureContent()
// 'warning' and 'passive mixed content' should never upgrade the
// security state from insecure to secure
if (e.securityState === 'secure' ||
(this.props.isSecure !== false &&
runInsecureContent !== true &&
['warning', 'passive-mixed-content'].includes(e.securityState))) {
isSecure = true
runInsecureContent = this.runInsecureContent()
} else if (e.securityState === 'insecure' || e.securityState === 'unknown') {
} else if (['broken', 'insecure'].includes(e.securityState)) {
isSecure = false
}
// TODO: handle 'warning' security state
// TODO: show intermediate UI for 'warning' and 'passive-mixed-content'
windowActions.setSecurityState(this.frame, {
secure: isSecure,
runInsecureContent
Expand Down
1 change: 1 addition & 0 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,7 @@ class Main extends ImmutableComponent {
.includes(siteTags.BOOKMARK_FOLDER)) || emptyMap
: null}
isFullScreen={frame.get('isFullScreen')}
isSecure={frame.getIn(['security', 'isSecure'])}
showFullScreenWarning={frame.get('showFullScreenWarning')}
findbarShown={frame.get('findbarShown')}
findDetail={frame.get('findDetail')}
Expand Down
12 changes: 12 additions & 0 deletions test/components/navigationBarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,18 @@ describe('navigationBar', function () {
assert(!classes.includes('fa-lock'))
)
})
it('shows secure icon on a site with passive mixed content', function * () {
const page1Url = 'https://mixed.badssl.com/'
yield this.app.client.tabByUrl(Brave.newTabUrl).url(page1Url).waitForUrl(page1Url).windowParentByUrl(page1Url)
yield this.app.client
.moveToObject(navigator)
.waitForExist(urlbarIcon)
.waitUntil(() =>
this.app.client.getAttribute(urlbarIcon, 'class').then((classes) =>
classes.includes('fa-lock')
)
)
})
it('Blocks running insecure content', function * () {
const page1Url = 'https://mixed-script.badssl.com/'
yield this.app.client.tabByUrl(Brave.newTabUrl)
Expand Down