summaryrefslogtreecommitdiff
path: root/app/experiments/application_experiment.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/experiments/application_experiment.rb
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
downloadgitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/experiments/application_experiment.rb')
-rw-r--r--app/experiments/application_experiment.rb12
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)