Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Homepage url validation for extension listing #12389

Merged
merged 6 commits into from
May 13, 2016

Conversation

swmitra
Copy link
Collaborator

@swmitra swmitra commented Apr 28, 2016

This PR adds some extra validation on homepage entry in extension listing under ExtensionManager view to make sure local binaries are not getting listed as homepage url.

Ping @nethip @abose @peterflynn for review.

@swmitra swmitra added this to the Release 1.7 milestone Apr 28, 2016
if (context.metadata.homepage) {
var parsed = PathUtils.parseUrl(context.metadata.homepage);
// Check if the homepage refers to a local resource
if (parsed.protocol.trim().toLowerCase() === "file:") {
Copy link
Contributor

Choose a reason for hiding this comment

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

@swmitra If have something like C:\Windows\System32\notepad.exe, will parsed.protocol list it under file:?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great catch as always:+1: @nethip .
You are right. It gives us "C:" as protocol 😄
Seems like we can use browser itself to give us all the relevant details of a url instead of relying on the text processing done by path-utils.

…ra/HomePageEntryValidation

# Conflicts:
#	src/extensibility/ExtensionManagerView.js
@swmitra
Copy link
Collaborator Author

swmitra commented May 13, 2016

@nethip Local resources without explicit mention of protocol should be checked now with the changes. Only http/https resources will get skipped.

@nethip
Copy link
Contributor

nethip commented May 13, 2016

@swmitra There seems to be some undesired changes, now part of the PR. Could you check and revert them?


// We can't rely on path-utils because of known problems with protocol identification
// Falling back to Browsers protocol identification mechanism
var tmpLink = document.createElement('a');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to create an 'a' element everytime. You can resuse it? The GC of V8 is memory hungry, so will never know when this will be GC'ed.

@nethip
Copy link
Contributor

nethip commented May 13, 2016

Travis is failing because of the API limitation. I have manually run grunt build and the build seems to be running fine. LGTM.

@nethip nethip merged commit adb414d into master May 13, 2016
@marcelgerber marcelgerber deleted the swmitra/HomePageEntryValidation branch May 19, 2016 22:41
marcelgerber pushed a commit that referenced this pull request May 19, 2016
Caused by interference between #12389 and #12203.
The former utilizes PathUtils, while the latter adapted PathUtils
to our normal require() workflow.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants