summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2016-11-18 12:08:30 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2016-11-18 12:30:32 +0100
commitdd826a5f20837f33263c658e41a4def0fc932069 (patch)
tree0b5a37b5a5f9c12bfef330e5286a165eae90fe2f /lib
parentf749fb7fe0574d07eeb38561b9af62754e518281 (diff)
downloadgitlab-ce-dd826a5f20837f33263c658e41a4def0fc932069.tar.gz
Return a consistent not found message
This prevents leakage of project names on an endpoint which is unauthenticated and thus open to the world.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/services.rb5
-rw-r--r--lib/mattermost/presenter.rb4
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/api/services.rb b/lib/api/services.rb
index e3c6a998631..4d23499aa39 100644
--- a/lib/api/services.rb
+++ b/lib/api/services.rb
@@ -67,7 +67,8 @@ module API
post ':id/services/:service_slug/trigger' do
project = Project.find_with_namespace(params[:id]) || Project.find_by(id: params[:id])
- not_found! unless project
+ # This is not accurate, but done to prevent leakage of the project names
+ not_found!('Service') unless project
service = project_service(project)
@@ -77,7 +78,7 @@ module API
status result[:status] || 200
present result
else
- not_found!
+ not_found!('Service')
end
end
end
diff --git a/lib/mattermost/presenter.rb b/lib/mattermost/presenter.rb
index b4e7358770f..f76d0376a98 100644
--- a/lib/mattermost/presenter.rb
+++ b/lib/mattermost/presenter.rb
@@ -14,8 +14,8 @@ module Mattermost
end
def help(commands, trigger)
- if commands.empty?
- ephemeral_response("No commands configured") unless messages.count > 1
+ if commands.zero?
+ ephemeral_response("No commands configured")
else
message = header_with_list("Available commands", commands)