Skip to content

Add feature flag control builds token encryption [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Marius Bobin requested to merge ci_builds_tokens_required_encryption into master

What does this MR do?

#332284 (closed)

Reduces the number of queries when builds are created:

[7] pry(main)> build = Ci::Build.new ;nil
=> nil
[8] pry(main)> build.ensure_token
  Ci::Build Load (1.4ms)  SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND "ci_builds"."token_encrypted" IN ('encrypted_value', 'encrypted_value') LIMIT 1
  Ci::Build Load (0.5ms)  SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND "ci_builds"."token" = 'plain_text_value' LIMIT 1 
=> "plain_text_value"
[9] pry(main)> Feature.enable(:ci_builds_tokens_required_encryption)
=> true
[10] pry(main)> build = Ci::Build.new ;nil
=> nil
[11] pry(main)> build.ensure_token
  Ci::Build Load (1.9ms)  SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND "ci_builds"."token_encrypted" IN ('encrypted_value', 'encrypted_value') LIMIT 1 
=> "plain_text_value"

Call stack:

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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 Marius Bobin

Merge request reports

Loading