Draft: Troubleshoot special char ES creds before 14.6
What does this MR do and why?
GitLab Support sometimes gets tickets about the ActionView::Template::Error (bad password component) error with non-encoded elasticsearch passwords issue. A fix was made available in GitLab 14.6. This MR provides a troubleshooting tip for folks who have not yet upgraded and may encounter this bug. This would help those folks resolve the 500
that this bug can lead to directly without needing to file a ticket. This came to my attention most recently through
This troubleshooting tip:
- notes that the problem is fixed in GitLab 14.6
- provides guidance on using the GitLab Rails Console to remove the problematic creds -- so the user can try again with new ones
- provides guidance on properly encoding the existing creds
Encode the existing credentials in-place
This encodes the existing credentials in-place.
ApplicationSetting.last.update(elasticsearch_password: URI.encode_www_form_component(ApplicationSetting.last.elasticsearch_password))
ApplicationSetting.last.update(elasticsearch_username: URI.encode_www_form_component(ApplicationSetting.last.elasticsearch_username))
After running this snippet, refresh and the 500
error should no longer appear.
Remove the problematic credentials
This removes the existing credentials; new credentials will need to be added.
ApplicationSetting.last.update(elasticsearch_password: nil)
ApplicationSetting.last.update(elasticsearch_username: nil)
If you know that the special characters causing the 500
are only in the username or only in the password, you can use a single applicable command from above and skip the other. After doing this, you'll need to supply the username, password or both. Be sure not to use the special character -- unless you have upgraded to GitLab 14.6 or later.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.