Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 33 users
Status: Fixed
Owner:
Closed: May 2015
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Feature

Blocking:
issue 420813


Participants' hotlists:
Security-UX-WebDev


Sign in to add a comment
Command line option for whitelisting specific origins to ease development and testing of websites using Secure Origin only features
Project Member Reported by kenjibaheux@chromium.org, Dec 12 2014 Back to list
We've confirmed with several teams that the Secure Origin requirement* for features like Service Worker hinders development and testing. We assumed that localhost (a perfectly valid secure origin) would be enough for these use cases but we were proven wrong.

An option to temporarily whitelist specific origins that have been setup for development and testing purposes has been asked for.


Proposal:
Add an aptly named command line to whitelist specific origins
e.g.
  --unsafely-treat-insecure-origin-as secure="http://app.example.org"

The command line may accept multiple origins.


Chrome must display a banner warning like it does with --disable-web-security. 

Joel also said he would also like to make sure that it doesn't leave anything persistent around. I assume that this means that registration triggered by these whitelisted origins should not persists.

Adding Review-security label for extra scrutiny, leaving as untriaged until reviewed.
 
Comment 1 by jww@chromium.org, Dec 12 2014
Cc: -joel@chromium.org jww@chromium.org
errata:
 1. got the wrong joel :( Sorry.
 2. ignore the * near the Secure Origin requirement.
 3. hyphen missing in the CLI => --unsafely-treat-insecure-origin-as-secure
Comment 3 by jww@chromium.org, Dec 12 2014
As an offhand comment about implementation to whomever is doing this, I imagine it will basically consist of adding a check in canAccessFeatureRequiringSecureOrigin() (https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/web/WebSecurityOrigin.cpp&q=canAccessF&sq=package:chromium&l=111) to see if the command line exists and, if so, check if the given origin is listed in the flag.
one off bug comment about the command line option's ability to let you specify multiple origins: 
 - allowed: specific origins (e.g. http://this.example.org and http://that.one.too.example.com)
 - not allowed: use of wildcard to describe generic origins (e.g. http://*.example.org)
As an offhand comment: I think getting the persistence story correct is necessary, but going to be INSANELY hard.

Suggestion: Require they specify a --user-data-dir that is not the default user's profile.

Suggestion 2: Date the profile, and require it be recreated after X days. The reason to not force clear it every shutdown is to permit tests that may need to relaunch Chrome several times, while discouraging users from making it the new normal.
Comment 6 by jww@chromium.org, Dec 12 2014
Suggestion 3: Only allow it in conjunction with --incognito?
jww: That seems to defeat the "make it useful for tests" case. So no, I don't think --incognito is sufficient.
Comment 8 by jww@chromium.org, Dec 17 2014
Cc: dominicc@chromium.org kenjibaheux@chromium.org
Why isn't wildcarding allowed? 

Given the subdomain-per-user model recommended at http://infrequently.org/2014/12/psa-service-workers-are-coming/ and that serviceworker dev is one of the motivating factors here, it seems like it may be useful in some cases.

What are the arguments against it?

[I'm also fine with arguments of keeping it simple until there is enough vocal demand for wildcarding, but wanted to understand if there were fundamental issues at play here]
Comment 10 by jww@chromium.org, Dec 18 2014
Allowing wildcarding would pretty much be taking away the whitelisting nature of the flag. Whitelists discourage absent-minded mistakes, and given how dangerous it is to have this enabled, it's important that developers be explicit about where they want it turned on. With wildcarding, all of a sudden you can bypass the whitelist entirely.
"Hey everybody! Want to use the great new features on our HTTP websites? This one cool command-line to use what Chrome developers don't want you to use!

--allow-something-something=*"

That is, the goal of having any sort of host-specific whitelist is to avoid the --insecure-web-feature-flag sort of hassle by making it less appealing to set it and forget it, and mitigate the damage (see also comment #5)

A wildcard undermines those goals, or you have to get into trickier and trickier 'security' guarantees ("We only allow *.eTLD+1" "Wait, that prevents *.appspot.com!") etc

In your service-worker-per-user model, bob.example.com and alice.example.com are different security principals (which is the point of that post), and thus shouldn't have conflated access. Similarly for command-line purpose, the 'developer' of the site is _either_ Bob or Alice, but not _both_ (otherwise, the separation wouldn't matter)
Great, thanks for the reasoning.

I was thinking restricting to eTLD+1 but as you point out there are
plenty of edge cases there.
Cc: jakearchibald@chromium.org jeffy@google.com
Labels: Needs-Feedback
+jeffy, +jake as our sounding boards

We've heard that the secure origin restriction can be quite stringent when it comes to test or develop something. 

We are considering adding the following command line option:

  --unsafely-treat-insecure-origin-as-secure="http://app.example.org"

  1. The command line may accept multiple origins but wildcarding is NOT allowed.
  2. Chrome must display a banner warning like it does with --disable-web-security. 
  3. It's desirable that what happened in this mode does not persist (details still under discussion)


Would this be reasonably good?
Comment 14 by jeffy@google.com, Jan 15 2015
That sounds reasonable to me as a way of addressing the automated testing use case.

For the "average web dev playing around" use case, I guess it's the best possible option. It would be nice if there was a list of origins that have been whitelisted exposed at chrome://serviceworker-internals (and chrome://inspect/#service-workers).
Cc: lgar...@chromium.org
+lgarron@: This bug is parallel with  issue 401386 .
Blocking: chromium:420813
Labels: Cr-Security-UX-WebDev
Labels: M-44
From feedback we got in SW hackathon in Tokyo it looks this feature would be useful for developers.  Could we aim for M44?
Hi! Based on my work on implementing a proof-of-concept offline functionality for MDN documentation[1], I have voiced my concerns over at GitHub[2] regarding the ability to work with Service Workers in more complex developer environments.

The MDN backend (dubbed "Kuma") is based on Django and the standard developer workflow uses a local instance via a VirtualBox VM (managed by Vagrant), executing the whole stack.[3] In such environments (running dynamic webpages without deploying them on a server with a valid SSL certificate for HTTPs connections) using/developing SW-based sites is troublesome at best. 

So far we have resorted to be using Chrome[4] started with the --ignore-certificate-errors command line flag, which at the moment gets the job done, but is, indeed, super-insecure and would be nice to be able to transition away from this workflow as soon as possible.
The command line flag, offered above is a great start and is, in fact, much in line with our thinking (stated @ GitHub[2]), but unfortunately solves just one half of the problem.

Due to the fact that the command-line flag requires launching the browser instance via a specific parameter, it is effectively unusable on any of the mobile platforms - however, IMHO, mobile testing on production devices might be just as important, if not more than desktop testing.

By making the local machine accessible via local network (i.e. setting up WiFi AP mode on dev machine or similar), one could connect to it from any garden-variety phone/tablet/etc. device but any following SW install would fail due to the the invalid SSL certificate served by the development server. Overcoming this would require some kind of mobile UI to make the same kind of whitelisting available on the (shipping) mobile clients (god forbid, the webview, even, if that is possible), that the above command-line parameter provides.

I have high hopes for Service Workers, so I would be very glad if we could weed out as many of the  unnecessary complications to the development & testing as possible to ease dev. adoption. Any feedback on the above is much welcome. Thank you!

[1]: https://wiki.mozilla.org/MDN/Get_involved/Events/HackOnMDN/Project:_Service_Workers#Notes.2C_limitations.2C_experiences_from_the_weekend
[2]: https://github.com/slightlyoff/ServiceWorker/issues/658#issuecomment-87283965
[3]: http://kuma.readthedocs.org/en/latest/installation-vagrant.html
[4]: https://wiki.mozilla.org/MDN/Get_involved/Events/HackOnMDN/Project:_Service_Workers#ServiceWorkers_-_Developer_QuickStart_Reference
Cc: palmer@chromium.org
+palmer explicitly, to make his codereviews take even and ever longer.
Reg #19: it'd be nice to provide a way to make this option available on mobile env but I'm not sure if we have a good alternative story (would a rough UI on serviceworker-internals or chrome://inspect/ work?).  For now let us start with a simple command-line one and see if we have a way to expand this on mobile.
Status: Available
Labels: -Pri-2 Pri-1
Reg: #13

 3. It's desirable that what happened in this mode does not persist (details still under discussion)

This part's still a bit unclear.  If this means that we need to clear up everything that's saved/stored during the session (but it shouldn't give an isolate profile like incognito mode) that sounds really really tough.

From #5 by rsleevi@chromium.org:

> Suggestion: Require they specify a --user-data-dir that is not the default user's profile.

Would this be acceptable to start with?  So it'd look like:

  --unsafely-treat-insecure-origin-as-secure="http://app.example.org"

  1. The command line may accept multiple origins but wildcarding is NOT allowed
  2. Chrome must display a banner warning like it does with --disable-web-security
  3. Require they also specify --user-data-dir
Re: the suggestion, I believe that the combination of #3 and #2 makes this alternative reasonable enough. Will confirm and suggest a string for the "disable-web-security" like banner to the group.
Owner: kinuko@chromium.org
Status: Assigned
Assigning this to myself.
Cc: paulir...@chromium.org
 Issue 401386  has been merged into this issue.
Project Member Comment 29 by bugdroid1@chromium.org, Apr 20 2015
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=194007

------------------------------------------------------------------
r194007 | kinuko@chromium.org | 2015-04-20T09:18:28.361590Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/blink_platform.gypi?r1=194007&r2=194006&pathrev=194007
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/weborigin/KnownPorts.cpp?r1=194007&r2=194006&pathrev=194007
   A http://src.chromium.org/viewvc/blink/trunk/Source/platform/weborigin/KnownPortsTest.cpp?r1=194007&r2=194006&pathrev=194007

Simplify protocol name and port comparison in KnwonPorts.cpp

Locking on hashmap initialization may causes problem when constructing
referer. Change it to a simpler approach.

(Original patch https://codereview.chromium.org/895793003/
created by Ian Wen (Ianwen@) and added test)

BUG= 373141 , 441605 
TEST=KnownPortsTest.IsDefaultPortForProtocol

Review URL: https://codereview.chromium.org/1074913004
-----------------------------------------------------------------
Project Member Comment 31 by bugdroid1@chromium.org, Apr 25 2015
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8cbea05bcd64f3a778d92435b6102e82c2cb435b

commit 8cbea05bcd64f3a778d92435b6102e82c2cb435b
Author: kinuko <kinuko@chromium.org>
Date: Sat Apr 25 13:35:43 2015

Move IsOriginSecure() into //content and use it in ServiceWorker

IsOriginSecure() implements web platform feature [1] and it'd be
more natural to provide this at content-layer.
Also ServiceWorker actually wants to call this in content layer
for browser-side security check.

https://www.w3.org/TR/powerful-features/#is-origin-trustworthy.

This CL moves IsOriginSecure() from
chrome/common/origin_util.{h,cc} to
content/{public/,}/common/origin_util.{h,cc}

and adds a following method to ContentClient so that ChromeContentClient
can add chrome-level schemes (and whitelisted origins, this is to be
implemented in  crbug.com/441605 ).

  // Gives the embedder a chance to register additional schemes and origins
  // that need to be considered trustworthy.
  // See https://www.w3.org/TR/powerful-features/#is-origin-trustworthy.
  virtual void AddSecureSchemesAndOrigins(std::set<std::string>* schemes,
                                          std::set<GURL>* origins) {}

BUG= 362214 ,  441605 
TEST=content_unittests:URLSchemesTest.IsOriginSecure

Review URL: https://codereview.chromium.org/1101033003

Cr-Commit-Position: refs/heads/master@{#326971}

[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/browser/content_settings/permission_context_base.cc
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/chrome_common.gypi
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/chrome_tests_unit.gypi
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/common/chrome_content_client.cc
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/common/chrome_content_client.h
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/chrome/common/chrome_switches.h
[delete] http://crrev.com/ca801973e5abfe45b9ce05c418dee51c4196404b/chrome/common/origin_util.cc
[delete] http://crrev.com/ca801973e5abfe45b9ce05c418dee51c4196404b/chrome/common/origin_util.h
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/browser/service_worker/service_worker_dispatcher_host.cc
[add] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/common/origin_util.cc
[rename] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/common/origin_util_unittest.cc
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/content_common.gypi
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/content_tests.gypi
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/public/common/content_client.cc
[modify] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/public/common/content_client.h
[add] http://crrev.com/8cbea05bcd64f3a778d92435b6102e82c2cb435b/content/public/common/origin_util.h

Cc: jochen@chromium.org
During the code review we realized that --user-data-dir is chrome/ level concept (but not content/), and if we require --user-data-dir together with this option we need to implement this at chrome/ layer, e.g. we can't support this in content_shell.

jochen@ is asking if we could just ignore ServiceWorker registrations from insecure origins when browser is running without the flag, assuming that accidentally running an insecure SW is the biggest threat we want to avoid.

jww@ and others: what do you think about this?

(I've also sent an email to jww@ and jochen@ to discuss this but feel free to respond on the issue too, we need to settle this asap)
Given the abuse we've seen, I feel like it's a bad idea to allow it to be used in the generic case.

I'm not sure why supporting it for content_shell is necessary/wise, but it seems like a scope creep from what was originally proposed.
Comment 35 by jww@chromium.org, Apr 30 2015
I'm not tied to --user-data-dir, but I am tied to having Service Worker registration wiped off the map after the browser shuts down (or some reasonable period of time). As rsleevi@ mentioned, the type of abuse we're concerned about is website foo.com saying, "try our awesome feature by running Chrome with --some-flag-chrome-doesnt-want-you-to-use every time you launch!"

We see this kind of stuff all the time (in fact, we're dealing with a major site doing exactly that today), and letting SWs persist forever as they normally would is really inviting this type of use. I'd be happy if, in practice, the flag used a new magical user directory somehow, and then other embedders can use it too, but I don't know what that would look like.

Alternatively, rsleevi@ also proposed expiring the user profile after X days, which would encourage users to do this. Another suggestion would be to keep track of the SW registrations and explicitly wipe them out after a few days.

Is there an immediate use case for content_shell? I don't consider this flag a feature, but a developer tool, and as such, other emebedders can implement their own developer tools as appropriate, so I guess, like rsleevi, I don't see what it's important to have this off the bat there.
Cc: ddorwin@chromium.org
There is a lot of discussion about expiring Service Workers, etc. Ideally, this command line option would be a turnkey solution for any feature that requires a secure origin.

If we need to support content_shell, can we add an IsNonDefaultUserDataDir() method to ContentClient or something?

However, doesn't the banner warning depend on chrome/ anyway? Thus, it may not make sense to support this in content_shell.
Thanks, the abuse scenario gives us much better understanding about what we want to avoid.

Reg: alternatives, expiring user profile apparently requires chrome layer support. ServiceWorker expiration can be implemented in content layer but we need to implement this expiration logic in each module whenever we find something abusive. I'm also worrying that having date/time dependent logic for security related feature as it's easy to introduce bugs.

Reg: banner warning yes it depends on chrome/ but the warning can be made on content-level switches too so it's not really blocking.

From the discussion I prefer starting with --user-data-dir, that introduces least complexity and we could add some expiration logic later too.  As ddorwin@ suggests we could work around the layering by adding some method in ContentClient() if it's desirable.

jochen@ - does it make sense?
k

i guess content shell could also just implement that command line option - it's a bit of a code duplication, but not a bad one
Project Member Comment 39 by bugdroid1@chromium.org, Apr 30 2015
The following revision refers to this bug:
  http://src.chromium.org/viewvc/blink?view=rev&rev=194750

------------------------------------------------------------------
r194750 | kinuko@chromium.org | 2015-04-30T16:46:10.425121Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/weborigin/SecurityPolicy.cpp?r1=194750&r2=194749&pathrev=194750
   M http://src.chromium.org/viewvc/blink/trunk/Source/platform/weborigin/SecurityPolicy.h?r1=194750&r2=194749&pathrev=194750
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/Init.cpp?r1=194750&r2=194749&pathrev=194750

Initializes SecurityPolicy static locals during blink initialization

These static locals could be touched before we initialize threading
(which is necessary to call AtomicallyInitializedStaticReference)
in chrome build, so simply using AtomicallyInitializedStaticReference
doesn't work well. On the other hand in non-chromium build we need
to make sure they're initialized before or during the blink initialization.

This patch does:
- changes AtomicallyInitializedStaticReference back to DEFINE_STATIC_LOCAL
- adds explicit SecurityPolicy::init() method and call it in the blink
  initialization
so that static locals are properly initialized regardless of whether
it's in chrome build or not.

(Note: without this patch chrome starts to crash once we land this patch:
https://codereview.chromium.org/1072933006/ and give the whitelisting options)

BUG= 441605 
TEST=green bots

Review URL: https://codereview.chromium.org/1117513003
-----------------------------------------------------------------
Project Member Comment 40 by bugdroid1@chromium.org, May 1 2015
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aaff1f6f8942f714a85a097228dd1e0fb13a36b8

commit aaff1f6f8942f714a85a097228dd1e0fb13a36b8
Author: kinuko <kinuko@chromium.org>
Date: Fri May 01 04:04:13 2015

Support whitelisting to handle insecure origins as trustworthy origins

The whitelist is given and initialized via
--unsafety-treat-insecure-origin-as-secure command-line flag. This needs to be specified with --user-data-dir
to take effect.

Specifying this flag shows a security banner:
"You are using unsupported command-line flag: ....
Stability and security will suffer."

Depends on blink-side patch:
https://codereview.chromium.org/1082173003/

BUG= 441605 
TEST=manual (to see SW on http works with command-line flag & the security banner is shown)
TEST=unit_tests:SecureOriginWhiteList.UnsafetyTreatInsecureOriginAsSecure
TEST=content_unittests:URLSchemesTest.IsOriginSecure
TEST=content_unittests:ServiceWorkerDispatcherHostTest.*

Review URL: https://codereview.chromium.org/1072933006

Cr-Commit-Position: refs/heads/master@{#327875}

[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/browser/chrome_content_browser_client.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/browser/ui/startup/bad_flags_prompt.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/chrome_common.gypi
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/chrome_tests_unit.gypi
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/common/chrome_content_client.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/common/chrome_switches.cc
[add] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/common/secure_origin_whitelist.cc
[add] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/common/secure_origin_whitelist.h
[add] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/common/secure_origin_whitelist_unittest.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/chrome/renderer/chrome_content_renderer_client.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/content/common/origin_util.cc
[modify] http://crrev.com/aaff1f6f8942f714a85a097228dd1e0fb13a36b8/content/public/common/origin_util.h

Status: Fixed
Labels: -Needs-Feedback Release-notes
Does this issue address the fact that `[mysubdomain].localhost:3000` is treated as insecure (even in Chrome Canary), making it impossible to develop/debug?
Yes, it fixes that. You need to run an instance with the two flags mentioned in the commmit for it to be a trusted origin for that instance.
How would I enable those flags, and what's the second flag?
Cc: mmenke@chromium.org cbentzel@chromium.org
mmenke, cbentzel: Regarding comment #43, should we change net::IsLocalhost to return true for *.localhost and/or *.localdomain? Currently:

 976 bool IsLocalhost(const std::string& host) {
 977   if (host == "localhost" || host == "localhost.localdomain" ||
 978       host == "localhost6" || host == "localhost6.localdomain6" ||
 979       IsLocalhostTLD(host))
 980     return true;
 981 
 982   IPAddressNumber ip_number;
 983   if (ParseIPLiteralToNumber(host, &ip_number)) {
 984     size_t size = ip_number.size();
 985     switch (size) {
 986       case kIPv4AddressSize: {
 987         IPAddressNumber localhost_prefix;
 988         localhost_prefix.push_back(127);
 989         for (int i = 0; i < 3; ++i) {
 990           localhost_prefix.push_back(0);
 991         }
 992         return IPNumberMatchesPrefix(ip_number, localhost_prefix, 8);
 993       }
 994 
 995       case kIPv6AddressSize: {
 996         struct in6_addr sin6_addr;
 997         memcpy(&sin6_addr, &ip_number[0], kIPv6AddressSize);
 998         return !!IN6_IS_ADDR_LOOPBACK(&sin6_addr);
 999       }
1000 
1001       default:
1002         NOTREACHED();
1003     }
1004   }
1005 
1006   return false;
1007 }

Broadening the definition of localhost, if safe and correct, could be very helpful for developers.
Exactly what I'm trying to do, and yes this would help a ton! Actually it says that * localhost * is supported, here: https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features but that seems to be off.
Palmer:  Doesn't the call to "IsLocalhostTLD" in line 979 of the code you pasted already do that for "*.localhost" (But not "*.localdomain")?  .localhost is reserved per RFC2606, but it doesn't look like localdomain is.
That tuple notation is how I write origins: (scheme, host, port). So (*, localhost, *) means "any scheme, the exact hostname localhost, and any port." In 46 I propose to change it to

    (*, *.localhost, *)

and/or

    (*, *.localdomain, *)

If the net/ people agree it's a good idea, we'll fix net::IsLocalhost and the documentation on that web page.
#48: Your eyes and brain work much better than mine. I am trying to take it all in stride.

I'm going to put some tests for *.localhost in content/common/origin_util_unittest.cc in a moment and see if maybe we're already good.

If .localdomain is not already reserved (I thought it was? Oh well), then we should not use it, and just stick with *.localhost. Which is hopefully enough for developers to work with.
If it's reserved, I'm certainly fine with adding.

I'm also fine with adding different ports, if we need to, but note that IsLocalhost takes a "host", not a HostPortPair.  If we're passing in string with port numbers to that method, think it's actually a bug in the caller.
Don't change that code :)

I reviewed it, it contains all of the reserved bits and nothing more ;)

.localdomain is definitely not reserved :)

estark@ added support for *.localhost and all is right (it would have been dangerous to change that function alone without changing the DNS resolver; if you dig up her CL, you can find the dangerous side-effects that could have happened)
https://codereview.chromium.org/1143633003/

  EXPECT_TRUE(IsOriginSecure(GURL("http://pumpkin.localhost/fun.html")));
  EXPECT_TRUE(IsOriginSecure(GURL("http://crumpet.pumpkin.localhost/fun.html")));

both pass, so I'm not sure why iradchenko is not seeing success in Canary. Are you sure your Canary is up to date?
Yes, but I also have a port, so mysub.localhost:3000/
I added 2 more test cases with non-standard ports, and they pass too.

iradchenko: Can you tell us more about what, specifically, you are trying to do? (What JavaScript API you are trying to call?) It might be that the API you are trying to call is not doing its security check with IsOriginSecure, but instead with some other ad hoc check. That would be a bug we should fix.
Also I'm using hash urls on the client, see the project at maldenma.beta.mapgeo.io, which locally is maldenma.localhost:3000 
On http://maldenma.beta.mapgeo.io, I get:

ServiceWorker Registration Error:  DOMException: Only secure origins are allowed. http://goo.gl/lq4gCo {message: "Only secure origins are allowed. http://goo.gl/lq4gCo", name: "NotSupportedError", code: 9, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2…}(anonymous function) @ map.js:15524

On https://maldenma.beta.mapgeo.io, I get:

GET https://maldenma.beta.mapgeo.io/ net::ERR_CONNECTION_TIMED_OUT

Still, Service Workers should work on http://mysub.localhost:3000. SW friends, any thoughts?
I used this example, pretty much word-for-word: https://github.com/GoogleChrome/samples/blob/gh-pages/app-install-banner/index.html
Project Member Comment 59 by bugdroid1@chromium.org, May 15 2015
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f9094b370aabf724f5ae8187bdd35e15d6091db2

commit f9094b370aabf724f5ae8187bdd35e15d6091db2
Author: palmer <palmer@chromium.org>
Date: Fri May 15 18:38:51 2015

Add more test cases for IsOriginSecure.

BUG= 441605 
TBR=davidben,mmenke

Review URL: https://codereview.chromium.org/1143633003

Cr-Commit-Position: refs/heads/master@{#330145}

[modify] http://crrev.com/f9094b370aabf724f5ae8187bdd35e15d6091db2/content/common/origin_util_unittest.cc

Should this be 
--unsafely-treat-insecure-origin-as-secure
Rather than
--unsafety-treat-insecure-origin-as-secure
#60: !! indeed.  Let me make a followup-patch and try to see if we can merge.
Labels: Merge-Request-44
Labels: ReleaseBlock-Beta
Requesting a merge for the typo fix (crrev.com/330404), this merge should be safe I assume.
Status: Assigned
(Reopening this in case it may not be considered for merge if it's marked fixed)
Neither works for me:

/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --unsafety-treat-insecure-origin-as-secure="http://maldenma.localhost:3000"

/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --unsafely-treat-insecure-origin-as-secure="http://maldenma.localhost:3000"
#66: did you try also giving --user-data-dir flag together?  The flag needs to be given together to take effect.  E.g.

/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --user-data-dir=/tmp/foo --unsafety-treat-insecure-origin-as-secure=http://your.insecure.site
Cc: penny...@chromium.org
Labels: -Merge-Request-44 Merge-Requested
Labels: Merge-Request-44
Labels: -Merge-Requested -Merge-Request-44 Merge-Approved-44
Sorry about the label confusion.

Might want to let your CL spend some time in a canary before merging.  But when you are very confident:

Merge approved for M44 branch 2403.
#67 thanks, that worked just fine.
Project Member Comment 72 by bugdroid1@chromium.org, May 20 2015
Labels: -Merge-Approved-44 merge-merged-2403
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bff801a9453d809e5bef371c03f25f9264307929

commit bff801a9453d809e5bef371c03f25f9264307929
Author: Kinuko Yasuda <kinuko@chromium.org>
Date: Wed May 20 09:14:52 2015

Merge: Fix typo in --unsafely-treat-insecure-origin-as-secure

'unsafety' must be 'unsafely', apparently.

BUG= 441605 
TBR=thestig

Review URL: https://codereview.chromium.org/1124173007

Cr-Commit-Position: refs/heads/master@{#330404}
(cherry picked from commit 722bc522935f02c4c481e10d926e3321a509bab8)

Review URL: https://codereview.chromium.org/1150473003

Cr-Commit-Position: refs/branch-heads/2403@{#29}
Cr-Branched-From: f54b8097a9c45ed4ad308133d49f05325d6c5070-refs/heads/master@{#330231}

[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/browser/chrome_content_browser_client.cc
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/browser/ui/startup/bad_flags_prompt.cc
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/common/chrome_switches.cc
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/common/chrome_switches.h
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/common/secure_origin_whitelist.cc
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/common/secure_origin_whitelist.h
[modify] http://crrev.com/bff801a9453d809e5bef371c03f25f9264307929/chrome/common/secure_origin_whitelist_unittest.cc

Status: Fixed
Project Member Comment 74 by bugdroid1@chromium.org, May 22 2015
The following revision refers to this bug:
  https://chrome-internal.googlesource.com/bling/chromium.git/+/bff801a9453d809e5bef371c03f25f9264307929

commit bff801a9453d809e5bef371c03f25f9264307929
Author: Kinuko Yasuda <kinuko@chromium.org>
Date: Wed May 20 09:14:52 2015

Components: -Security>UX>WebDev
Labels: Hotlist-Security-UX-WebDev
Labels: -merge-merged-2403 -review-security Merge-Merged-2403 Review-Security
 --unsafely-treat-insecure-origin-as-secure chrome shows unsupported command line flag stability and security will suffer in Version 53.0.2785.101 m
issue.png
5.5 KB View Download
Sign in to add a comment