Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should ports be considered as part of domain? #13

Open
stevage opened this issue May 5, 2016 · 7 comments
Open

Should ports be considered as part of domain? #13

stevage opened this issue May 5, 2016 · 7 comments

Comments

@stevage
Copy link
Contributor

stevage commented May 5, 2016

Currently, terriajs-server treats these as three different domains:

"foo",
"foo:80",
"foo:8000"

Is this a good thing? I found it very unintuitive when attempting to add a WMS server using a non-standard port. Couldn't work out why it wasn't being proxied.

@kring
Copy link
Member

kring commented May 5, 2016

Certainly browsers consider these to be different hosts for CORS purposes, so I think it's reasonable that we do too. We could add a feature where * in place of the port means "any port" maybe?

@stevage
Copy link
Contributor Author

stevage commented May 6, 2016

Hmm, alternatively, "foo" could mean "all ports on foo", and "foo:80" could mean "only port 80". What would the downside of this be?

@kring
Copy link
Member

kring commented May 8, 2016

Well if you ask me, we (NationalMap and our others apps) should just run an open proxy. The benefits substantially outweigh the risks IMO. But that's not a universal opinion. And similarly, people might argue that opening up all ports on a given host is riskier because it increases the likelihood of things like using our proxy to connect to a compromised server running on a non-standard port, or causing harm to a poorly written non-HTTP server by sending it craftily designed HTTP requests via our proxy.

So if you buy into that fear at all, you might also think that making it easy to (accidentally?) whitelist non-standard ports is a bad thing. I don't really feel strongly about it either way though.

@stevage
Copy link
Contributor Author

stevage commented May 8, 2016 via email

@RacingTadpole
Copy link
Contributor

RacingTadpole commented May 19, 2016

One thought - as a way of implementing steve's last point, we could allow an explicit wildcard such as *. Then the whitelist could include both csiro.au and *wms*.

@kring
Copy link
Member

kring commented May 19, 2016

I think allowing *wms* is not much different from just having an open proxy. It's pretty easy to include a string like that someplace in just about any URL. But I do like the idea of filtering based on the content. i.e. ensure that the request looks like a valid GetCapabilities or GetMap and that the response is a proper WMS XML document. That's a fair bit of work though.

@x-Code-x
Copy link

Drive by comment FWIW :)

tl;dr:

  • URI's are unique by definition
  • URI schemes do include the authority portion
  • Thus, if you currently have a policy which allows wildcards in the authority portion of the URI (e.g. .csiro.au, data.gov.), then by extension, that policy already covers wildcards for ports.
  • x2 tl;dr on next para: maybe think about making an open proxy branch/deployment of Terria, and an AusGov security FTW version (which may be able to assume FedLink implementations talking to FedLinked data sources so all IP's are safe, and where wildcard ports may well be accepted for upstream sources, as long as downstream endpoints are locked to 80.

Long version

Re: Steve's first comment - overall that is a correct implementation of the standard afaik - they are indeed 3 different "things" (authorities in fact, which contain the same "foo" domain portion. Example 2 is however fact redundant (since default for HTTP is 80) in that foo and foo:80 de-reference to the same "thing". Note that 3986 states "URI producers and normalizers should omit the port component and its ":" delimiter if port is empty or if its value would be the same as that of the scheme's default." , however, it is a SHOULD, not MUST.

Now while the above tl;dr initial points might be technically correct (the best kind) against the RFC paste below - a harsh reality given how Terria apps are fast becoming a standard feature of the WoG open data ecosystem - your colleagues at Industry (namely Vanguard/AusKey etc) may have some very valid points around wild carding anything in the authority portion of the URI - namely - issues (technical or otherwise) around wild carded certificates etc - it's very much looking like agencies are more likely to want to explicitly name ports/defaults/sub-doms etc due to the troubles in managing certificate type things.

(All in all: just random drive by thoughts. Personal PoV and all that. Oh - Steve's points around whitelisting on the path - IMO that works, since those patterns are likely to be surprisingly standard moving forwards (thinking standard API patterns, standardised data.gov.au subdoms etc) which would allow for a lot of flexibility around say, running a federated Terria data provider network (a.k.a Government ;) )...

(Sorry - I should go for walks at lunch instead of reading GitHub updates)

C.

https://tools.ietf.org/html/rfc3986#section-3.2

Given authority = [ userinfo "@" ] host [ ":" port ]

3.2.3. Port
The port subcomponent of authority is designated by an optional port number in decimal following the host and delimited from it by a single colon (":") character.

     port        = *DIGIT

A scheme may define a default port. For example, the "http" scheme defines a default port of "80", corresponding to its reserved TCP port number. The type of port designated by the port number (e.g., TCP, UDP, SCTP) is defined by the URI scheme. URI producers and normalizers should omit the port component and its ":" delimiter if port is empty or if its value would be the same as that of the scheme's default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants