diff options
Diffstat (limited to 'app/services/security/ci_configuration/sast_parser_service.rb')
-rw-r--r-- | app/services/security/ci_configuration/sast_parser_service.rb | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/app/services/security/ci_configuration/sast_parser_service.rb b/app/services/security/ci_configuration/sast_parser_service.rb index 5220525d552..cae9a90f0a0 100644 --- a/app/services/security/ci_configuration/sast_parser_service.rb +++ b/app/services/security/ci_configuration/sast_parser_service.rb @@ -74,19 +74,11 @@ module Security def sast_excluded_analyzers strong_memoize(:sast_excluded_analyzers) do - all_analyzers = Security::CiConfiguration::SastBuildAction::SAST_DEFAULT_ANALYZERS.split(', ') rescue [] - enabled_analyzers = sast_default_analyzers.split(',').map(&:strip) rescue [] - excluded_analyzers = gitlab_ci_yml_attributes["SAST_EXCLUDED_ANALYZERS"] || sast_template_attributes["SAST_EXCLUDED_ANALYZERS"] - excluded_analyzers = excluded_analyzers.split(',').map(&:strip) rescue [] - ((all_analyzers - enabled_analyzers) + excluded_analyzers).uniq + excluded_analyzers.split(',').map(&:strip) rescue [] end end - def sast_default_analyzers - @sast_default_analyzers ||= gitlab_ci_yml_attributes["SAST_DEFAULT_ANALYZERS"] || sast_template_attributes["SAST_DEFAULT_ANALYZERS"] - end - def sast_template_attributes @sast_template_attributes ||= build_sast_attributes(sast_template_content) end @@ -109,17 +101,17 @@ module Security yaml_result = Gitlab::Ci::YamlProcessor.new(content, options).execute return {} unless yaml_result.valid? - sast_attributes = yaml_result.build_attributes(:sast) - extract_required_attributes(sast_attributes) + extract_required_attributes(yaml_result) end - def extract_required_attributes(attributes) + def extract_required_attributes(yaml_result) result = {} - attributes[:yaml_variables].each do |variable| + + yaml_result.yaml_variables_for(:sast).each do |variable| result[variable[:key]] = variable[:value] end - result[:stage] = attributes[:stage] + result[:stage] = yaml_result.stage_for(:sast) result.with_indifferent_access end end |