diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-13 18:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-13 18:09:34 +0300 |
commit | c4eeda2d3d048e84b331f416472e99ed0e116904 (patch) | |
tree | d2ac30119226e46f54f41961e3eed2cd5b5bdb5b /app/experiments | |
parent | cdd5eba514e79c7801ff2eeb76e915e3f31ca5d7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/experiments')
-rw-r--r-- | app/experiments/application_experiment.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb index e5b67527cb1..863a2c41d4c 100644 --- a/app/experiments/application_experiment.rb +++ b/app/experiments/application_experiment.rb @@ -34,12 +34,14 @@ class ApplicationExperiment < Gitlab::Experiment # # @deprecated def key_for(source, seed = name) - source = source.keys + source.values if source.is_a?(Hash) - - ingredients = Array(source).map { |v| identify(v) } - ingredients.unshift(seed) + # If FIPS is enabled, we simply call the method available in the gem, which + # uses SHA2. + return super if Gitlab::FIPS.enabled? - Digest::MD5.hexdigest(ingredients.join('|')) + # If FIPS isn't enabled, we use the legacy MD5 logic to keep existing + # experiment events working. + source = source.keys + source.values if source.is_a?(Hash) + Digest::MD5.hexdigest(Array(source).map { |v| identify(v) }.unshift(seed).join('|')) end def nest_experiment(other) |