Page MenuHomePhabricator

Allow each tool to have its own subdomain for browser sandbox/cookie isolation
Closed, ResolvedPublic

Assigned To
Authored By
Bawolff
Feb 2 2016, 10:27 PM
Referenced Files
None
Tokens
"Love" token, awarded by aborrero."Love" token, awarded by dbarratt."Like" token, awarded by He7d3r."Orange Medal" token, awarded by Krinkle."Love" token, awarded by MichaelSchoenitzer.

Description

Lots of tool labs tools are of varying quality. It is highly like that many of them have XSS vulnrabilities. I think it might be prudent to give each one a separate domain (So instead of tools.wmflabs.org/tool-name do tool-name.tools.wmflabs.org). This would make it much more difficult to steal cookies, etc from other tools, if someone got an xss (Of course this doesn't eliminate everything (see e.g. https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-zheng.pdf but it does make exploiting that sort of thing that much harder. )

I have no idea how difficult a thing this would be to do

Related Objects

StatusSubtypeAssignedTask
Resolvedaborrero
Resolvedyuvipanda
Resolvedaborrero
ResolvedKrenair
ResolvedNone
ResolvedAndrew
Resolvedaborrero
Resolvedaborrero
Resolvedaborrero
Declined Bstorm
Resolvedaborrero
Resolvedbd808
ResolvedBUG REPORTbd808
Resolved Bstorm
ResolvedUrbanecm
Resolvedaborrero
Resolvedbd808
Resolvedbd808
Resolvedtaavi
ResolvedBUG REPORTDannyS712
ResolvedBUG REPORTCyberpower678
ResolvedBUG REPORTPara
Resolvedbd808
OpenNone

Event Timeline

Bawolff raised the priority of this task from to Needs Triage.
Bawolff updated the task description. (Show Details)
Bawolff added projects: Security-Team, Toolforge.
Bawolff subscribed.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript

It requires a *.tools.wmflabs.org ssl certificate, but otherwise there's no technical reason why this would not be possible.

As for other (non-tools.wmflabs.org) domains -- that's somewhat more involved, because it requires more than a single new certificate. See T122403 for that.

valhallasw renamed this task from consider making individual tools on tool labs have their own domain to consider making individual tools on tool labs have their own X.tools.wmflabs.org subdomain.Feb 2 2016, 10:31 PM

It requires a *.tools.wmflabs.org ssl certificate, but otherwise there's no technical reason why this would not be possible.

As for other (non-tools.wmflabs.org) domains -- that's somewhat more involved, because it requires more than a single new certificate. See T122403 for that.

I think tools is the project where this sort of thing would get the most benefit.

The only problem would be that we already have advertised in some places login.tools.wmflabs.org, but that can be moved.

I'll put in a procurement ticket for a new *. ssl cert.

I think many (most?) tools are not coded in a way that they can be served from https://$tool.tools.wmflabs.org/ and https://tools.wmflabs.org/$tool/ at the same time, and I think that is impossible to correctly automatically map one to the other (e. g. fixing absolute links in the served pages themselves as well).

So if we go down this road, webservice should have a new option --with-subdomain (or a better name) that sets a flag in the proxy forward entry and the service.manifest file and uses a lighttpd configuration, etc. that expects subdomain URLs. The proxy would implement the logic:

  • https://tools.wmflabs.org/$tool/$path:
    • If --with-subdomain is set for $tool:
      • Redirect permanently to https://$tool.wmflabs.org/$path with an explanation why.
    • Else:
      • Serve as usual.
  • https://$tool.wmflabs.org/$path:
    • If --with-subdomain is set for $tool:
      • Serve as (then) usual.
    • Else:
      • Return an error page with information for maintainers on how to enable subdomain hosting for their tool.

We could potentially:

  • redirect //tools.wmflabs.org/$tool/$path to //$tool.tools.wmflabs.org/$tool/$path,
  • redirect //$tool.tools.wmflabs.org to //$tool.tools.wmflabs.org//$tool.

unless some flag is specified, but I'm also fine with making it fully opt-in.

I do remember thinking about this last night/this morning and finding another issue that needed to be addressed, but I forgot what the issue was :-(. I believe it was something in the direction of Cross-origin resource sharing, i. e. if there are gadgets, etc. on wikis that are configured to be able to interact with tools.wmflabs.org, but not necessarily *.tools.wmflabs.org.

valhallasw moved this task from Backlog to Ready to be worked on on the Toolforge board.
Krinkle renamed this task from consider making individual tools on tool labs have their own X.tools.wmflabs.org subdomain to Allow tools to have their own X.tools.wmflabs.org subdomain.Nov 30 2016, 1:50 AM
Krinkle renamed this task from Allow tools to have their own X.tools.wmflabs.org subdomain to Allow tools to have their own ".tools.wmflabs.org" subdomain.

The only problem would be that we already have advertised in some places login.tools.wmflabs.org, but that can be moved.

Also checker.tools.wmflabs.org.

We own the domain toolforge.org and moving to that may be easier than using the existing tools.wmflabs.org root. Let's Encrypt wildcard certs are possible now: https://community.letsencrypt.org/t/acme-v2-and-wildcard-certificate-support-is-live/55579

I would be very interested in a project to figure out how to use $TOOL.toolforge.org as the default hostname for webservices exposed from the Toolforge Kubernetes cluster. This could give us a chance to implement a better ingress for the cluster, make TLS required (T102367), and fix the URL namespacing issue all together.

bd808 renamed this task from Allow tools to have their own ".tools.wmflabs.org" subdomain to Allow each tool to have its own subdomain for browser sandbox/cookie isolation.Mar 14 2018, 5:43 PM
bd808 removed a project: Cloud-Services.

May I suggest that the priority of this task be increased somewhat? Without going into too much detail – until this task is fixed, no Toolforge tool can fully protect itself against attacks from other tools. (Sufficiently privileged users can see e. g. T211424 for some more details on possible attacks, though I doubt it’s the only relevant task.)

As a tool author, I would already be very happy with a purely opt-in solution, and we can worry about making it the default for Kubernetes-hosted tools, requiring TLS, etc. later.

Sufficiently privileged users can see e. g. T211424 for some more details on possible attacks, though I doubt it’s the only relevant task.

If I guessed what T211424 is about correctly, T157450 should describe the somewhat-general case. It's linked as the parent task of this task.

Are we supposed to have a CNAME of *.tools.wmflabs.org, or are we going to assign each tool's DNS entries individually? I think after DNS works, we can start playing with domainproxy and see how that will work.

Yep, that’s the same case (thanks for adding me as a subscriber). Good to know that this issue isn’t “lowest” priority because the ramifications were unknown, but rather in spite of them being known for years…

I think a record for *.tools.wmflabs.org (or *.toolforge.org, to avoid conflicts with login.tools.wmflabs.org and other existing subdomains) would be enough, there’s no need to make the (non-)existence of a tool known via DNS IMHO. But I’m not sure why you’re suggesting a CNAME record – should tools.wmflabs.org be the canonical name?

Ping on this one again, and I see action going on at https://phabricator.wikimedia.org/T215531 which is great! However, do we have an approximate ETA on when we would finish the migration ?

Ping on this one again, and I see action going on at https://phabricator.wikimedia.org/T215531 which is great! However, do we have an approximate ETA on when we would finish the migration ?

Per https://www.mediawiki.org/wiki/Wikimedia_Technology/Goals/2019-20_Q2#Technical_Engagement -- we are hoping to have a new Kubernetes cluster deployed in Toolforge on or before 2019-12-31. Full migration of existing workloads to this cluster and removal of the legacy cluster will follow in FY19/20 Q3 (2020-01-01 - 2020-03-31). Giving a more concrete timeline is work that we are tracking in T237784: Document migration plans and timelines.

bd808 raised the priority of this task from Lowest to Medium.Jan 1 2020, 6:23 PM
bd808 merged a task: Restricted Task.
bd808 added subscribers: sbassett, Samwilson, Matanya and 4 others.

This is possible now! See https://wikitech.wikimedia.org/wiki/News/Toolforge.org for instructions on migrating your tool during the opt-in period. Follow along on T234617: Toolforge. introduce new domain toolforge.org for further information.

bd808 assigned this task to aborrero.
bd808 added a subscriber: aborrero.

All Toolforge tools now have unique hostnames in the form $TOOL.toolforge.org! This is honestly a huge step forward in the security of webservices running on Toolforge. Big thanks from me to @aborrero for leading the project to introduce this feature and to all of the Toolforge maintainers who helped us find problems during and after the opt-in period.