Implement an internal API to handle mailroom webhook calls
- Implement an internal API:
POST /api/v4/internal/mail_room/*address. The API is a thin wrapper to receive the request, classify the address based onaddressURL parameters, then push toEmailReceiverWorkerandServiceDeskEmailReceiverWorkeraccordingly. The address-worker mapping is available in Gitlab::MailRoom. - This endpoint should also capture the size limiter rejection exceptions and return 400 status.
- The JWT authentication needs a shared secret file between mailroom gem and Rails code base. As there are two addresses, we must add a
secret_filefield to each address configuration inconfig/gitlab.yml:
incoming_email:
enabled: true
address: "gitlab-incoming+%{key}@gmail.com"
user: "gitlab-incoming@gmail.com"
password: "[REDACTED]"
secret_file: "/home/gitlab/gitlab_mailroom_secret"
# Blah blah
service_desk_email:
enabled: true
address: "gitlab-incoming+%{key}@gmail.com"
user: "gitlab-incoming@gmail.com"
password: "[REDACTED]"
secret_file: "/home/gitlab/gitlab_mailroom_secret"
# blah blah
- Add
JwtAuthenticableauthentication to the aforementioned endpoint. This concern supports a single secret path at the moment. We'll need to modify it a bit to support two address secret files.
Edited by Quang-Minh Nguyen