Skip to content

Change the unique index on `security_findings` table

What does this MR do?

Since we will have the same finding multiple times we should scope them to scan records.

Database review

rake db:migrate

== 20201215132151 ChangeUniqueIndexOnSecurityFindings: migrating ==============
-- transaction_open?()
   -> 0.0000s
-- indexes(:security_findings)
   -> 0.0039s
-- remove_index(:security_findings, {:algorithm=>:concurrently, :name=>"index_security_findings_on_uuid"})
   -> 0.0022s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:security_findings, [:uuid, :scan_id], {:unique=>true, :name=>"index_security_findings_on_uuid_and_scan_id", :algorithm=>:concurrently})
   -> 0.0022s
-- add_index(:security_findings, [:uuid, :scan_id], {:unique=>true, :name=>"index_security_findings_on_uuid_and_scan_id", :algorithm=>:concurrently})
   -> 0.0032s
== 20201215132151 ChangeUniqueIndexOnSecurityFindings: migrated (0.0128s) =====

rake db:migrate:down

-- transaction_open?()
   -> 0.0000s
-- indexes(:security_findings)
   -> 0.0044s
-- remove_index(:security_findings, {:algorithm=>:concurrently, :name=>"index_security_findings_on_uuid_and_scan_id"})
   -> 0.0024s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:security_findings, :uuid, {:unique=>true, :name=>"index_security_findings_on_uuid", :algorithm=>:concurrently})
   -> 0.0021s
-- add_index(:security_findings, :uuid, {:unique=>true, :name=>"index_security_findings_on_uuid", :algorithm=>:concurrently})
   -> 0.0026s
== 20201215132151 ChangeUniqueIndexOnSecurityFindings: reverted (0.0129s) =====

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 Mehmet Emin INAC

Merge request reports

Loading