diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-08 21:16:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-08 21:16:03 +0300 |
commit | e3bd590af430a430dcbcdd25751c46bbd1ecf56c (patch) | |
tree | 328bb248b90ec25f0f2274658b67ef059777df51 /lib/gitlab/ci/parsers | |
parent | 6225d57e55eaa0205e939e7ed6577636b0ee47cf (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/parsers')
-rw-r--r-- | lib/gitlab/ci/parsers/security/common.rb | 17 | ||||
l--------- | lib/gitlab/ci/parsers/security/validators/schemas/dependency-scanning-report-format.json | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/gitlab/ci/parsers/security/common.rb b/lib/gitlab/ci/parsers/security/common.rb index 0c969daf7fd..9aec615d012 100644 --- a/lib/gitlab/ci/parsers/security/common.rb +++ b/lib/gitlab/ci/parsers/security/common.rb @@ -42,11 +42,22 @@ module Gitlab attr_reader :json_data, :report, :validate def valid? - return true if !validate || schema_validator.valid? + if Feature.enabled?(:enforce_security_report_validation) + if !validate || schema_validator.valid? + report.schema_validation_status = :valid_schema + true + else + report.schema_validation_status = :invalid_schema + schema_validator.errors.each { |error| report.add_error('Schema', error) } + false + end + else + return true if !validate || schema_validator.valid? - schema_validator.errors.each { |error| report.add_error('Schema', error) } + schema_validator.errors.each { |error| report.add_error('Schema', error) } - false + false + end end def schema_validator diff --git a/lib/gitlab/ci/parsers/security/validators/schemas/dependency-scanning-report-format.json b/lib/gitlab/ci/parsers/security/validators/schemas/dependency-scanning-report-format.json new file mode 120000 index 00000000000..11e0a6846fb --- /dev/null +++ b/lib/gitlab/ci/parsers/security/validators/schemas/dependency-scanning-report-format.json @@ -0,0 +1 @@ +14.0.0/dependency-scanning-report-format.json
\ No newline at end of file |