Skip to content

Harden Usage Ping | Redis Counters

Alina Mihaila requested to merge 212402-harden-usage-ping-redis-counters-2 into master

What does this MR do?

With this Mr we bring the Redis counters hardening in place.

There can be 2 types of Redis counters according to the current implementation and therefor we see it used in 2 different ways

Proposed solution

Implementation consistent with alt_data_usage, count and count_distinct Fallback in -1 value. Handles ::Redis::CommandError, Gitlab::UsageDataCounters::BaseCounter::UnknownEvent errors

Method: redis_usage_data(counter = nil, fallback: -1, &block)

Arguments:

  • counter: A redis counter on which we expect to have method totals for counter results and fallback_totals for the same hash keys and having values -1, the fallback
  • fallback: by default -1
  • block: the code block that could be evaluated to a single value

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

Closes #212402 (closed)

Edited by Alina Mihaila

Merge request reports