Class: Fastlane::Actions::DependencyCheckIosAnalyzerAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



33
34
35
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 33

def self.authors
  ["Alexey Alter-Pesotskiy"]
end

.available_optionsObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 47

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :skip_spm_analysis,
      description: 'Skip analysis of SPM dependencies',
      optional: true,
      default_value: false,
      is_string: false,
      type: Boolean
    ),
    FastlaneCore::ConfigItem.new(
      key: :skip_pods_analysis,
      description: 'Skip analysis of CocoaPods dependencies',
      optional: true,
      default_value: false,
      is_string: false,
      type: Boolean
    ),
    FastlaneCore::ConfigItem.new(
      key: :spm_checkouts_path,
      description: 'Path to Swift Packages, if resolved',
      optional: true,
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :pod_file_lock_path,
      description: 'Path to the Podfile.lock file, if exists',
      optional: true,
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_path,
      description: 'Path to the directory that contains an Xcode project, workspace or package. Defaults to root',
      optional: true,
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_name,
      description: "The project's name",
      optional: true,
      default_value: 'DependencyCheck',
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_directory,
      description: 'The directory in which all reports will be stored',
      optional: true,
      default_value: 'dependency-check',
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_types,
      description: 'Comma separated list of the output types (e.g. html, xml, csv, json, junit, sarif, all)',
      optional: true,
      default_value: 'sarif',
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :cli_version,
      description: 'Overwrite the version of DependencyCheck analyzer. Not recommended',
      optional: true,
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :verbose,
      description: 'The file path to write verbose logging information',
      optional: true,
      is_string: true,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :fail_on_cvss,
      description: 'Specifies if the build should be failed if a CVSS score above a specified level is identified. ' \
                   'Since the CVSS scores are 0-10, by default the build will never fail',
      optional: true,
      default_value: 11,
      is_string: false,
      type: Integer
    ),
    FastlaneCore::ConfigItem.new(
      key: :junit_fail_on_cvss,
      description: 'Specifies the CVSS score that is considered a failure when generating the junit report',
      optional: true,
      default_value: 0,
      is_string: false,
      type: Integer
    ),
    FastlaneCore::ConfigItem.new(
      key: :keep_binary_on_exit,
      description: 'Keep DependencyCheck binary and data on exit',
      optional: true,
      default_value: true,
      is_string: false,
      type: Boolean
    ),
    FastlaneCore::ConfigItem.new(
      key: :suppression,
      description: 'Path to suppression file',
      optional: true,
      is_string: true,
      type: String
    )
  ]
end

.categoryObject



159
160
161
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 159

def self.category
  :testing
end

.descriptionObject

Documentation #



29
30
31
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 29

def self.description
  'Fastlane wrapper around the OWASP dependency-check iOS analyzers (Swift Package Manager and CocoaPods).'
end

.example_codeObject



37
38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 37

def self.example_code
  [
    dependency_check_ios_analyzer(
      project_name: 'SampleProject',
      output_types: 'html, junit',
      fail_on_cvss: 3
    )
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


163
164
165
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 163

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.on_exit(params:, result:) ⇒ Object



19
20
21
22
23
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 19

def self.on_exit(params:, result:)
  Helper::ConfigurationHelper.clean_up(params)
  say_goodbye = '✨ Check out the report for further investigation.'
  result ? UI.important(say_goodbye) : UI.user_error!(say_goodbye)
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/dependency_check_ios_analyzer/actions/dependency_check_ios_analyzer_action.rb', line 9

def self.run(params)
  params[:output_types] = Helper::ConfigurationHelper.parse_output_types(params[:output_types])
  bin_path = Helper::ConfigurationHelper.install(params)

  spm_analysis = Helper::AnalyzerHelper.analize_packages(bin_path: bin_path, params: params)
  pods_analysis = Helper::AnalyzerHelper.analize_pods(bin_path: bin_path, params: params)

  on_exit(params: params, result: (spm_analysis && pods_analysis))
end