Rewrite all corrupted tokens before saving in reset_encrypted_tokens

What does this MR do and why?

Rewrite all corrupted tokens before saving in reset_encrypted_tokens

Changelog: fixed

References

gitlab:doctor:reset_encryption_tokens task fail... (#558408 - closed)

How to set up and validate locally

  • Update application_settings with invalid encrypted tokens using rails console
setting = ApplicationSetting.first
setting.update_columns(
runners_registration_token_encrypted: 'aaa',
error_tracking_access_token_encrypted: 'bbb'
)
  • Run the rake task
MODEL_NAMES=ApplicationSetting TOKEN_NAMES=runners_registration_token,error_tracking_access_token gitlab-rake gitlab:doctor:reset_encrypted_tokens
  • Validate the tokens
setting.reload
# should print the updated token without error
puts setting.runners_registration_token
puts setting.error_tracking_access_token

MR acceptance checklist

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

Edited by Narendran

Merge request reports

Loading