From 873ec955363eb4de87c34d08b7032b140bf680e7 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 1 Jul 2022 15:52:43 -0700 Subject: [PATCH 1/3] Fix deploy keys breaking protected branch dropdown in FIPS mode In FIPS mode, if a deploy key were present, clicking on the "Allowed to push" dropdown would fail with a "Failed to load groups, users and deploy keys" message. This occurred because the JavaScript attempted to use the `fingerprint` attribute of the key. However, on a FIPS system, the MD5 fingerprint is not available, and the `null` value breaks the dropdown. To fix this, we use the `fingerprint_sha256` attribute instead. This commit also puts the SHA256 fingerprint first in the HTML views to avoid confusion. Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/364562 Changelog: fixed --- .../admin/deploy_keys/components/table.vue | 22 +++++++++++++--- .../deploy_keys/components/key.vue | 18 ++++++++++--- .../projects/settings/access_dropdown.js | 4 ++- .../settings/components/access_dropdown.vue | 6 +++-- app/views/shared/deploy_keys/_form.html.haml | 11 +++++--- locale/gitlab.pot | 5 +++- spec/features/projects/deploy_keys_spec.rb | 26 +++++++++++++++---- .../deploy_keys/components/table_spec.js | 12 ++++++--- .../components/new_access_dropdown_spec.js | 23 ++++++++++++---- 9 files changed, 100 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/admin/deploy_keys/components/table.vue b/app/assets/javascripts/admin/deploy_keys/components/table.vue index 29e8b9a724eb03..46e7ac3cf2814c 100644 --- a/app/assets/javascripts/admin/deploy_keys/components/table.vue +++ b/app/assets/javascripts/admin/deploy_keys/components/table.vue @@ -34,9 +34,13 @@ export default { key: 'title', label: __('Title'), }, + { + key: 'fingerprint_sha256', + label: __('Fingerprint (SHA256)'), + }, { key: 'fingerprint', - label: __('Fingerprint'), + label: __('Fingerprint (MD5)'), }, { key: 'projects', @@ -130,10 +134,18 @@ export default { } this.items = items.map( - ({ id, title, fingerprint, projects_with_write_access, created_at }) => ({ + ({ id, title, fingerprint, + fingerprint_sha256, + projects_with_write_access, + created_at, + }) => ({ + id, + title, + fingerprint, + fingerprint_sha256, projects: projects_with_write_access, created: created_at, }), @@ -196,8 +208,12 @@ export default { > + +