Skip to content

Attempt reading schema file instead of a file named `#{report_version}`

What does this MR do and why?

Make Gitlab::Ci::Parsers::Security::Validators::SchemaValidator attempt reading the actual schema file located under ee/lib/ee/gitlab/ci/parsers/security/validators/schemas/#{report_version}/#{report-type}-report-format.json instead of a file named #{report_version}.

Related to #390154 (closed)

How to set up and validate locally

  1. git checkout v15.4.0-ee
  2. Grab report from #390154 (comment 1262264836)
  3. Run the following script in Rails console
stub = OpenStruct.new(id: 1) # Alternatively you can pass in an existing Project but it's used only for logging purposes
validator = ::Gitlab::Ci::Parsers::Security::Validators::SchemaValidator.new('dast', JSON.parse(File.read("/path/to/report/pretty-gl-dast-report.json")), "15.0.2", project: stub)
  1. It should return errors outlined in #390154 (comment 1262378754)
  2. Switch to this branch
  3. Rerun the script from step 2
  4. No errors should be shown

MR acceptance checklist

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

Edited by Michał Zając

Merge request reports