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

extension icons should appear #11143

Merged
merged 1 commit into from
Dec 22, 2017
Merged

Conversation

kevinlawler
Copy link
Contributor

changes file:// to chrome://brave for extension icon loading

Issue #11142

Auditors:
@bridiver @diracdeltas @darkdh @jonathansampson

@NejcZdovc NejcZdovc added this to the 0.21.x (Nightly Channel) milestone Sep 26, 2017
@@ -24,6 +24,13 @@ module.exports.fileUrl = (filePath) => {
return encodeURI('file://' + fileUrlPath)
}

module.exports.chromeUrl = (filePath = '') => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to have some unit tests for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added in 1bc13ba

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a relative path instead and make it filesystem agnostic?

@@ -24,6 +24,13 @@ module.exports.fileUrl = (filePath) => {
return encodeURI('file://' + fileUrlPath)
}

module.exports.chromeUrl = (filePath = '') => {
filePath = module.exports.fileUrl(filePath)
filePath = filePath.replace('file://', 'chrome://brave')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the chrome://brave to file:// mapping implemented in muon? it seems like a potential security hole since it can be used to bypass CSP restrictions; we should make sure chrome://brave loads are blocked in untrusted contexts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i'm curious what CSP violations are being triggered? app/extensions/brave/index.html explicitly allows img-src file: but not chrome: so i'm confused why the original issue happens

Copy link
Contributor Author

@kevinlawler kevinlawler Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played with the CSP file but couldn't get the violation to reveal itself either. It might be some other security restriction. The error from the console is

[75566:775:0922/145254.257520:ERROR:CONSOLE(0)] "Not allowed to load local resource:
    file:///Users/user/Desktop/brave/browser-laptop-bootstrap/src/browser-laptop/app/extensions/metalmash/images/icon-19.png", 
    source: chrome://brave/Users/user/Desktop/brave/browser-laptop-bootstrap/src/browser-laptop/app/extensions/brave/index-dev.html (0)

and it disappears when switching to chrome://brave. Subsequently the image loads.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas chrome://brave can't be loaded from web pages Not allowed to load local resource: chrome://brave/usr/local/brave/browser-laptop-bootstrap/README.md. When I originally tested them it also wasn't possible to load them by entering the url manually, but I just tested again and it is now possible because we added support for chrome://* urls in general so we should probably block them from the urlbar

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the csp can't allow something that is prohibited by default (access to file resources) which is why the file:// urls don't work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine if chrome://brave URLs can be loaded manually from the urlbar since that is also possible for file URLs. just want to make sure there is nothing they can do that files URLs can't do, other than be loaded in the chrome:// context.

@kevinlawler kevinlawler force-pushed the fix/chrome-url-extensions-icons branch from b0b367b to 1bc13ba Compare September 26, 2017 23:44
@cezaraugusto
Copy link
Contributor

what's the current status of this?

@cezaraugusto cezaraugusto added the needs-info Another team member needs information from the PR/issue opener. label Oct 14, 2017
@bbondy bbondy modified the milestones: 0.21.x (Developer Channel), 0.20.x (Beta Channel), Backlog Oct 25, 2017
changes file:// to chrome://brave

Issue #11142

Auditors:
@bridiver @diracdeltas @darkdh @jonathansampson

fix whitespace

add unit test
@bsclifton bsclifton force-pushed the fix/chrome-url-extensions-icons branch from 1bc13ba to a51b7ea Compare December 22, 2017 18:06
@bsclifton bsclifton changed the title extension icons should appear (macOS) extension icons should appear Dec 22, 2017
@bsclifton
Copy link
Member

Submitted security review after seeing the above text:
https://github.com/brave/internal/issues/167

@bsclifton bsclifton modified the milestones: Triage Backlog, 0.20.x (Beta Channel) Dec 22, 2017
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ works great 😄 👍

@bsclifton bsclifton merged commit cc39571 into master Dec 22, 2017
@bsclifton bsclifton deleted the fix/chrome-url-extensions-icons branch December 22, 2017 19:58
bsclifton added a commit that referenced this pull request Dec 22, 2017
bsclifton added a commit that referenced this pull request Dec 22, 2017
@bsclifton
Copy link
Member

master cc39571
0.21.x 1890583
0.20.x 494cf4e

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature/extensions needs-info Another team member needs information from the PR/issue opener. QA/test-plan-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants