diff options
Diffstat (limited to 'app/experiments/application_experiment.rb')
-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) |