Skip to content

Fix a bug when checking future renewals for a subgroup

Vijay Hawoldar requested to merge fix-future-renewal-service into master

What does this MR do?

The CheckFutureRenewalService class is used to determine if a customer's expiring subscription has already been renewed on our subscription purchasing application, CustomersDot.

When enabling the gitlab_subscription_future_renewal feature flag, it highlighted an oversight in the class whereby it could be called with a sub-group namespace, which is a problem because the class calls namespace.gitlab_subscription, but a GitlabSubscription can only be associated with a root namespace.

This MR addresses the problem by doing two things:

  1. ensuring we use the root_ancestor of the given namespace
  2. returning early if that root namespace doesn't have any gitlab subscription associated

Point 2 shouldn't be needed, or ever happen, because you cannot have an expiring subscription without a subscription 😅. But because we cannot control how the service will be used in future, I've added this extra measure to ensure it will be handled gracefully.

Refs #329985 (closed)

Screenshots (strongly suggested)

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 Vijay Hawoldar

Merge request reports