From d4f6e1f21c40c729d5ed3a3f02d6a84777a40163 Mon Sep 17 00:00:00 2001 From: blackst0ne Date: Wed, 20 Jun 2018 14:18:16 +1100 Subject: [PATCH] [Rails5] Fix ActionCable '/cable' mountpoint conflict Since Rails 5.0 the new framework has been added. It's called ActionCable. It brings WebSockets support to rails applications. By default the mountpoint of WebSocket requests is `/cable` [1]. GitLab allows using top level names as namespaces or usernames. For example, `gitlab.com/cable` at this moment leads to a user with the nickname `cable`. This commit changes ActionCable's mountpoint to a reserved top level word `-`. This is just a stub and should not be be used in real work. Please set correct mountpoints for each environments when configuring ActionCable for real using. [1]: https://github.com/rails/rails/blob/5-0-stable/actioncable/lib/action_cable.rb#L38 --- ...uld-cause-conflicts-with-existing-namespaced-routes.yml | 5 +++++ config/application.rb | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 changelogs/unreleased/blackst0ne-rails5-found-new-routes-that-could-cause-conflicts-with-existing-namespaced-routes.yml diff --git a/changelogs/unreleased/blackst0ne-rails5-found-new-routes-that-could-cause-conflicts-with-existing-namespaced-routes.yml b/changelogs/unreleased/blackst0ne-rails5-found-new-routes-that-could-cause-conflicts-with-existing-namespaced-routes.yml new file mode 100644 index 00000000000..c8d916af824 --- /dev/null +++ b/changelogs/unreleased/blackst0ne-rails5-found-new-routes-that-could-cause-conflicts-with-existing-namespaced-routes.yml @@ -0,0 +1,5 @@ +--- +title: "[Rails5] Fix ActionCable '/cable' mountpoint conflict" +merge_request: 20015 +author: "@blackst0ne" +type: fixed diff --git a/config/application.rb b/config/application.rb index 95f6d2c9af1..385eb65e7f4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -57,6 +57,13 @@ module Gitlab # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" + # ActionCable mount point. + # The default Rails' mount point is `/cable` which may conflict with existing + # namespaces/users. + # https://github.com/rails/rails/blob/5-0-stable/actioncable/lib/action_cable.rb#L38 + # Please change this value when configuring ActionCable for real usage. + config.action_cable.mount_path = "-" if rails5? + # Configure sensitive parameters which will be filtered from the log file. # # Parameters filtered: