Fix incorrect status on unknown email
What does this MR do and why?
Describe in detail what your merge request does and why.
When the signature is verified, but the email address does not correspond to a user in GitLab,
we should return the :other_user
status instead of the :unverified
status. This lets the
user know that the signature is valid, but the signature was either signed by somebody else,
or they aren't using the correct email address on their account.
Spotted in: !97248 (comment 1175679946)
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
Enabled the
ssh_commit_signatures
feature flag via the Rails console:Feature.enable(:ssh_commit_signatures)
-
Login as root or another user whose email address does not match the one from
git config --get user.email
-
Create a new project.
-
Clone the repository and change into the project directory
-
Configure git to sign commits with SSH:
git config gpg.format ssh # Might be id_rsa instead git config user.signingkey ~/.ssh/id_ed25519
-
Add a new SSH signed commit and push it
echo '# SSH Commit Test' > README.md git add README.md git commit -S -m 'This commit is signed with ssh' git push origin main
-
Reload the project page. Observe that the badge states that the commit belongs to another user.
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.