diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index f6096f036f..2c56922d9d 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -98,6 +98,7 @@ partiallySecureConnection=Partially insecure connection partiallySecureConnectionInfo=This page was loaded over HTTPS, but some elements were not loaded securely. insecureConnection=Using an insecure connection insecureConnectionInfo=Your connection to this site is not private. An eavesdropper may be able to tamper with this page and read your data. +phishingConnectionInfo=javascript:, data:, and blob: URLs are not secure and may be used for phishing attacks. Be careful when entering passwords and sensitive information! blockedTrackingElements={{blockedTrackingElementsSize}} Blocked tracking elements replacedAds={{replacedAdsSize}} Ads replaced blockedAds={{blockedAdsSize}} Ads blocked diff --git a/app/renderer/components/urlBarIcon.js b/app/renderer/components/urlBarIcon.js index 9132dcea0f..d075a6d76d 100644 --- a/app/renderer/components/urlBarIcon.js +++ b/app/renderer/components/urlBarIcon.js @@ -9,6 +9,7 @@ const cx = require('../../../js/lib/classSet') const dragTypes = require('../../../js/constants/dragTypes') const dndData = require('../../../js/dndData') const {isSourceAboutUrl} = require('../../../js/lib/appUrlUtil') +const {isPotentialPhishingUrl} = require('../../../js/lib/urlutil') const searchIconSize = 16 class UrlBarIcon extends ImmutableComponent { @@ -18,7 +19,9 @@ class UrlBarIcon extends ImmutableComponent { this.onDragStart = this.onDragStart.bind(this) } get iconCssClasses () { - if (this.isSearch) { + if (isPotentialPhishingUrl(this.props.location)) { + return ['fa-exclamation-triangle', 'insecure-color'] + } else if (this.isSearch) { return ['fa-search'] } else if (this.isAboutPage && !this.props.titleMode) { return ['fa-list'] diff --git a/app/renderer/reducers/urlBarReducer.js b/app/renderer/reducers/urlBarReducer.js index cdba2cdf36..b1f1616cbe 100644 --- a/app/renderer/reducers/urlBarReducer.js +++ b/app/renderer/reducers/urlBarReducer.js @@ -6,7 +6,7 @@ const windowConstants = require('../../../js/constants/windowConstants') const {getSourceAboutUrl, getSourceMagnetUrl, isIntermediateAboutPage, navigatableTypes} = require('../../../js/lib/appUrlUtil') -const {isURL, getUrlFromInput} = require('../../../js/lib/urlutil') +const {isURL, isPotentialPhishingUrl, getUrlFromInput} = require('../../../js/lib/urlutil') const {activeFrameStatePath, frameStatePath, getFrameByKey, getActiveFrame, tabStatePath} = require('../../../js/state/frameStateUtil') const urlParse = require('../../common/urlParse') @@ -28,6 +28,11 @@ const urlBarReducer = (state, action) => { const currentLocation = frame.get('location') const parsedUrl = urlParse(action.location) + // For potential phishing pages, show a warning + if (isPotentialPhishingUrl(action.location)) { + state = state.setIn(['ui', 'siteInfo', 'isVisible'], true) + } + // For types that are not navigatable, just do a loadUrl on them if (!navigatableTypes.includes(parsedUrl.protocol)) { if (parsedUrl.protocol !== 'javascript:' || diff --git a/js/components/siteInfo.js b/js/components/siteInfo.js index 83625ad4fe..043dfaae0f 100644 --- a/js/components/siteInfo.js +++ b/js/components/siteInfo.js @@ -6,6 +6,7 @@ const React = require('react') const ipc = require('electron').ipcRenderer const ImmutableComponent = require('./immutableComponent') const cx = require('../lib/classSet') +const {isPotentialPhishingUrl} = require('../lib/urlutil') const Dialog = require('./dialog') const Button = require('./button') const appActions = require('../actions/appActions') @@ -58,6 +59,9 @@ class SiteInfo extends ImmutableComponent { get location () { return this.props.frameProps.getIn(['location']) } + get maybePhishingLocation () { + return isPotentialPhishingUrl(this.props.frameProps.getIn(['location'])) + } render () { // Figure out the partition info display let l10nArgs = { @@ -93,7 +97,11 @@ class SiteInfo extends ImmutableComponent { viewCertificateButton =