Skip to content

Add support for encryption to job artifacts

Matt Kasa requested to merge mattkasa/235879-add-artifact-encryption into master

What does this MR do?

Add support for encryption to job artifacts

  • Adds an encrypted boolean to Ci::JobArtifact
  • Adds encrypted_file to Ci::JobArtifact
  • Uses mount_encrypted_file_store_uploader to conditionally encrypt artifacts

Relates to #235879 (closed)

Migration Output

Up

== 20210126114248 AddEncryptedToCiJobArtifact: migrating ======================
-- add_column(:ci_job_artifacts, :encrypted, :boolean, {:default=>false})
   -> 0.0057s
-- add_column(:ci_job_artifacts, :encrypted_file, :text, {:null=>true})
   -> 0.0008s
== 20210126114248 AddEncryptedToCiJobArtifact: migrated (0.0066s) =============

== 20210126114334 AddTextLimitToCiJobArtifactEncryptedFile: migrating =========
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0004s
-- execute("ALTER TABLE ci_job_artifacts\nADD CONSTRAINT check_1106f8b3ff\nCHECK ( char_length(encrypted_file) <= 255 )\nNOT VALID;\n")
   -> 0.0023s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0004s
-- execute("ALTER TABLE ci_job_artifacts VALIDATE CONSTRAINT check_1106f8b3ff;")
   -> 0.0008s
-- execute("RESET ALL")
   -> 0.0006s
== 20210126114334 AddTextLimitToCiJobArtifactEncryptedFile: migrated (0.0173s) 

Down

== 20210126114334 AddTextLimitToCiJobArtifactEncryptedFile: reverting =========
-- execute("ALTER TABLE ci_job_artifacts\nDROP CONSTRAINT IF EXISTS check_1106f8b3ff\n")
   -> 0.0016s
== 20210126114334 AddTextLimitToCiJobArtifactEncryptedFile: reverted (0.0080s) 

== 20210126114248 AddEncryptedToCiJobArtifact: reverting ======================
-- remove_column(:ci_job_artifacts, :encrypted_file, :text, {:null=>true})
   -> 0.0022s
-- remove_column(:ci_job_artifacts, :encrypted, :boolean, {:default=>false})
   -> 0.0013s
== 20210126114248 AddEncryptedToCiJobArtifact: reverted (0.0068s) =============

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 Matt Kasa

Merge request reports