Skip to content

Harden flipper feature.get access

What does this MR do?

Harden flipper feature.get access

For ab_feature_enabled makes sure we don't get a runtime error if flipper implementation for get changes

Closes #220008 (closed)

The Feature.get always returns an object no matter what, so even if flipper_feature wasn't needed - but could fail if flipper changed that behavior.

pry(main)> ::Feature.get(:non_existing_ff).gate_values[:percentage_of_actors]
  Feature::FlipperGate Load (0.3ms)  SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = 'non_existing_ff'
=> 0
pry(main)> ::Feature.get(:non_existing_ff)
=> #<Flipper::Feature:47281543805920 name=:non_existing_ff, state=:off, enabled_gate_names=[], adapter=:memoizable>
pry(main)> ::Feature.get(:non_existing_ff).gate_values[:percentage_of_actors]
=> 0

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 Phil Calder

Merge request reports