Class: Gitlab::Ci::Parsers::Sbom::CyclonedxProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/parsers/sbom/cyclonedx_properties.rb

Overview

Parses GitLab CycloneDX metadata properties which are defined by the taxonomy at gitlab.com/gitlab-org/security-products/gitlab-cyclonedx-property-taxonomy

This parser knows how to process schema version 1 and will not attempt to parse later versions. Each source type has it’s own namespace in the property schema, and is also given its own parser. Properties are filtered by namespace, and then passed to each source parser for processing.

Constant Summary collapse

SUPPORTED_SCHEMA_VERSION =
'1'
GITLAB_PREFIX =
'gitlab:'
SOURCE_PARSERS =
{
  'dependency_scanning' => ::Gitlab::Ci::Parsers::Sbom::Source::DependencyScanning
}.freeze
SUPPORTED_PROPERTIES =
%w[
  meta:schema_version
  dependency_scanning:category
  dependency_scanning:input_file:path
  dependency_scanning:source_file:path
  dependency_scanning:package_manager:name
  dependency_scanning:language:name
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ CyclonedxProperties

Returns a new instance of CyclonedxProperties.



33
34
35
# File 'lib/gitlab/ci/parsers/sbom/cyclonedx_properties.rb', line 33

def initialize(properties)
  @properties = properties
end

Class Method Details

.parse_sourceObject



29
30
31
# File 'lib/gitlab/ci/parsers/sbom/cyclonedx_properties.rb', line 29

def self.parse_source(...)
  new(...).parse_source
end

Instance Method Details

#parse_sourceObject



37
38
39
40
41
42
# File 'lib/gitlab/ci/parsers/sbom/cyclonedx_properties.rb', line 37

def parse_source
  return unless properties.present?
  return unless supported_schema_version?

  source
end