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

Commit

Permalink
do not show phishing warning for javascript URLs
Browse files Browse the repository at this point in the history
Test Plan:
1. go to any site and bookmark it
2. click 'edit bookmark' in the bookmark toolbar
3. change the bookmark's location to 'javascript:alert(1)'
4. click the bookmark. you should see an alert appear without a phishing warning.
  • Loading branch information
diracdeltas committed Apr 6, 2017
1 parent aea8ac9 commit 58985e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/lib/urlutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const UrlUtil = {
isPotentialPhishingUrl: function (url) {
if (typeof url !== 'string') { return false }
const protocol = urlParse(url.trim().toLowerCase()).protocol
return ['data:', 'blob:', 'javascript:'].includes(protocol)
return ['data:', 'blob:'].includes(protocol)
},

/**
Expand Down
5 changes: 1 addition & 4 deletions test/unit/lib/urlutilTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,8 @@ describe('urlutil', function () {
it('returns true if input is a data URL', function () {
assert.equal(UrlUtil.isPotentialPhishingUrl('data:text/html,<script>alert("no crash")</script>'), true)
})
it('returns true if input is a js URL', function () {
assert.equal(UrlUtil.isPotentialPhishingUrl(' JAVASCRIPT:alert(1)'), true)
})
it('returns true if input is a blob URL', function () {
assert.equal(UrlUtil.isPotentialPhishingUrl(' blob:foo '), true)
assert.equal(UrlUtil.isPotentialPhishingUrl(' BLOB:foo '), true)
})
})
})

0 comments on commit 58985e6

Please sign in to comment.