Commit d934fd37 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '195668-key-lookup-sha256-fingerprint' into 'master'

Look up SSH keys by SHA256 fingerprint, not MD5 fingerprint

See merge request gitlab-org/gitlab!66371
parents d0727132 1428e0e4
......@@ -165,9 +165,9 @@ module API
# Check whether an SSH key is known to GitLab
#
get '/authorized_keys', feature_category: :source_code_management do
fingerprint = Gitlab::InsecureKeyFingerprint.new(params.fetch(:key)).fingerprint
fingerprint = Gitlab::InsecureKeyFingerprint.new(params.fetch(:key)).fingerprint_sha256
key = Key.find_by_fingerprint(fingerprint)
key = Key.find_by_fingerprint_sha256(fingerprint)
not_found!('Key') if key.nil?
present key, with: Entities::SSHKey
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment