Skip to content

Service Desk email get rejected when you use a project suffix

Summary

When I declare a "Project name suffix" (for example "support") And then write an E-Mail to contact-project+<user/group>--support@incoming.gitlab.com it gets rejected

Steps to reproduce

Steps to reproduce

  1. create a project
  2. enable service desk
  3. declare a "Project name suffix"
  4. send an email to the new generated address (contact-project+<user/group>--support@incoming.gitlab.com) to create a ticket

What is the current bug behavior?

Email get's rejected:

Unfortunately, your email message to GitLab could not be processed.

We couldn't find the project. Please check if there's any typo.

What is the expected correct behavior?

Service Desk creates a new ticket/ issue

Relevant logs and/or screenshots

Es1i_XdXIAgyTj9 Es1jT2CWMAINj9e

Output of checks

This bug happens on GitLab.com

Why is this happening

In ServiceDeskHandler when we see there is a matching project key, we try to find a project by it project = Project.find_by_service_desk_project_key(match[:key]). But the project_key is not unique across projects therefore incorrect project can be found. Afterwards, valid_project_key?(project, match[:slug]) will return false which is correct as incorrect project has been found.

We should ideally search project by its full_path. But we get the path in the slug form so it is not that easy.

We use Gitlab::Utils.slugify method for that. With this method, eg. group/test-one and group/test/one paths will be resulting to the same string group-test-one.

Edited by Jarka Košanová