Skip to content

Resolve "LicenseHelper uses "extend self" inapproriately"

What does this MR do?

  1. The LicenseHelper module has a number of methods that use instance variables for memoization.
  2. At the end of the module, extend self is called.
  3. This results in the memoization being stored in the module itself for these calls. So it's cached for the life of the process

This PR is about:

  1. Remove the memoization from the module level.
  2. Find a home for the methods that require some additional input (project / group) - just so they live along some other methods that do similar things

By leaving all the original definitions (but one) in place in the LicenseHelper we make sure that all the external references that are using those will still find the definition. (and by not altering the logic we ensure that this definition will behave and return as expected)

The method that was moved was referenced by a single template and was properly updated on the template's end

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

Closes #3326 (closed)

Edited by Michael Kozono

Merge request reports