Skip to content

Add a shared avatar image for security policy bots

Marcos Rocha requested to merge mc_rocha-avatar-security-policy-bot-users into master

What does this MR do and why?

In MR !145423 (merged), we add an avatar image for the new security policy bots. In MR !145718 (closed), we planned to add the same avatar image for the existing security policy bots. However, as discussed in this comment, this would introduce a lot of duplicate images. To avoid many duplicate avatar images in this MR, we are adding a shared image for the security policy bots.

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.

Screenshots or screen recordings

Before After
Screenshot_2024-03-07_at_9.22.40_AM
Screenshot_2024-03-07_at_4.53.17_PM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

If you already have a project with a security policy, you should have a security_polity_bot user without an avatar. If that is the case, just run the migration and check if the migration updated the bot with the security-bot avatar.

If you don't have a project with a security policy, follow the steps below:

  1. Create a new project
  2. Go to Secure > Policies
  3. Click on New policy
  4. Select Merge request approval policy
  5. Change to .yaml mode
  6. Copy the yaml below:
type: approval_policy
name: a
description: ''
enabled: true
rules:
  - type: license_finding
    match_on_inclusion: true
    license_types:
      - 3dfx Glide License
    license_states:
      - newly_detected
    branch_type: protected
actions:
  - type: require_approval
    approvals_required: 1
    role_approvers:
      - owner
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  1. Click on Configure with a merge request
  2. Merge the new MR to add the policy
  3. After our work in !145423 (merged), the policy bots are created with an avatar. To test this MR, we need to delete the avatar with the command below in the rails console:
User.where(user_type: :security_policy_bot).last.update_column(:avatar, nil)
  1. Go to Manage > Members and verify the GitLab Security Policy bot has the security-bot avatar.
  2. Verify the avatar is still nil in the database
User.where(user_type: :security_policy_bot).last.avatar
  1. Click on the GitLab Security Policy bot
  2. On the GitLab Security Policy bot profile page, put the mouse into the avatar and verify the path ends with /assets/bot_avatars/security-bot.png

image

Edited by Marcos Rocha

Merge request reports