Skip to content

Fix 500 error when using a instance runner registration token

What does this MR do and why?

#463509 (closed) reported a bug where using an instance runner registration token to register a runner, in a situation where the instance was configured to not allow runner registration tokens, would result in a 500 error, instead of the expected 410 Gone error.

This MR has 2 commits:

  • The first fixes tests to correctly reproduce real-world scenario and make the error that caused the 500 error to surface.
  • The second fixes the actual behavior by preventing the call to ActiveSupport::SecurityUtils.secure_compare with a nil value.

Changelog: fixed

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Go to http://gdk.test:3000/admin/runners and take note of the runner registration token

  2. Go to http://gdk.test:3000/admin/application_settings/ci_cd#js-runner-settings and disable the Allow runner registration token checkbox:

    image

  3. On the shell, run the gitlab-runner register command to register the runner with the previously noted registration token.

It should output a 410 Gone error, instead of a 500 error.

Edited by Pedro Pombeiro

Merge request reports