Reverify externally verified gpg keys
What does this MR do and why?
- Add externally_verified_at to gpg_keys
- Reverify based on time since externally_verified_at rather than updated_at
- Reverify keys even if they were previously externally invalid
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Setup
- Add a gpg key
- Create a project
- Activate the beyond identity integration for the instance (e.g
http://gdk.test:3000/admin/application_settings/integrations/beyond_identity
)
Test successful responses
- Modify beyond identity check to be successful (https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/integrations/beyond_identity.rb#L71-73)
def execute(params)
return
::Gitlab::BeyondIdentity::Client.new(self).execute(params)
end
- Create a signed commit and push to the project
- Check that the gpg key has
externally_verified
set to true andexternally_verified_at
has been updated - Add another gpg key and see that it is
externally_verified
andexternally_verified_at
has been set
Test unsuccessful responses
- Modify beyond identity check to be unsuccessful (https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/integrations/beyond_identity.rb#L71-73)
def execute(params)
raise ::Gitlab::BeyondIdentity::Client::ApiError.new('simulated error', 500)
::Gitlab::BeyondIdentity::Client.new(self).execute(params)
end
- Set
externally_verified_at
for one of the gpg keys to be earlier than 1 day ago (e.ggpg_key.update(externally_verified_at: 2.days.ago)
) - Create a signed commit and try to push to the project with that gpg key.
- See that
externally_verified
is set to false andexternally_verified_at
has been set
Related to #473193 (closed)