Skip to content

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 on address URL parameters, then push to EmailReceiverWorker and ServiceDeskEmailReceiverWorker accordingly. 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_file field to each address configuration in config/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 JwtAuthenticable authentication 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