Treat GroupDeployKeys like DeployKeys

What does this MR do?

GroupDeployKeys should be treated like DeployKeys, this is currently not the case, especially the is_a?(DeployKey) check does not match GroupDeployKeys and thus would create some security issues once GroupDeployKeys are accessible to users:

=> #<DeployKey id: 2, user_id: 1, created_at: "2021-05-02 12:59:28", updated_at: "2021-05-02 12:59:28", key: [FILTERED], title: [FILTERED], type: "DeployKey", fingerprint: "4c:85:8f:ae:8b:f4:c5:55:88:25:17:24:76:71:da:03", public: false, last_used_at: "2021-05-02 1...
irb(main):002:0> x.is_a?(DeployKey)
=> true
irb(main):003:0> x.type
=> "DeployKey"
irb(main):004:0> y = GroupDeployKey.first
=> #<GroupDeployKey id: 1, user_id: 1, created_at: "2021-05-02 12:34:02", updated_at: "2021-05-02 12:34:02", last_used_at: nil, expires_at: nil, key: [FILTERED], title: [FILTERED], fingerprint: "65:72:3b:e4:fa:b2:c1:ef:a5:89:84:6d:ae:09:25:52", fingerprint_sha256: ...
irb(main):005:0> y.type
=> "DeployKey"
irb(main):006:0> y.is_a?(DeployKey)
=> false

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Joern Schneeweisz

Merge request reports

Loading