Skip to content

Fix Security training URL cached by language cache key selection

What does this MR do and why?

While validating #362697 (closed) it was discovered that an error had been made in the introduction of language parameter filtering of security training URLs which only demonstrated while using GitLab's Reactive Caching mechanism. During local testing this was disabled, hiding the error.

This MR ensure that the appropriate details are passed to fetch the desired URLs from the reactive cache if a response has been cached.

Screenshots or screen recordings

Screenshot_from_2022-05-30_22-45-20

Screenshot_from_2022-05-30_22-45-40

How to set up and validate locally

  1. Configure local project.
  2. Navigate to /-/security/configuration on the respective project and enable the Kontra and SecureCodeWarrior training integrations for that project.
  3. Navigate to your local GitLab /-/graphql-explorer
  4. The following query will present a set of security training urls for your respective project
{
  project(fullPath: "") {
    securityTrainingUrls(identifierExternalIds: ["CWE-94", "91"]) {
      name
      url
      status
      identifier
    }
  }
}
  1. Applying the filename parameter with a recognised file extension will result in the appropriate language filtering. Unrecognised extensions are disregarded.
{
  project(fullPath: "") {
    securityTrainingUrls(identifierExternalIds: ["CWE-94", "91"], filename: "thing.rb") {
      name
      url
      status
      identifier
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #362697 (closed)

Edited by Gregory Havenga

Merge request reports

Loading