emasser 3.10.0 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +4 -4
- data/.github/workflows/gh-pages.yml +1 -1
- data/.github/workflows/push-to-docker-mail.yml +5 -5
- data/.github/workflows/push-to-docker.yml +4 -4
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/test-cli.yml +1 -1
- data/CHANGELOG.md +52 -2
- data/Gemfile.lock +7 -7
- data/README.md +17 -16
- data/docs/features.md +397 -222
- data/emasser.gemspec +1 -1
- data/lib/emasser/configuration.rb +4 -4
- data/lib/emasser/constants.rb +0 -4
- data/lib/emasser/delete.rb +78 -16
- data/lib/emasser/get.rb +416 -209
- data/lib/emasser/help/artifacts_del_mapper.md +2 -2
- data/lib/emasser/help/milestone_del_mapper.md +1 -1
- data/lib/emasser/help/poam_del_mapper.md +1 -1
- data/lib/emasser/output_converters.rb +14 -4
- data/lib/emasser/version.rb +1 -1
- metadata +4 -4
data/emasser.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency 'dotenv', '~> 2.7.6'
|
30
30
|
spec.add_runtime_dependency 'rubyzip', '~> 2.3.2'
|
31
31
|
spec.add_runtime_dependency 'thor', '~> 1.1.0'
|
32
|
-
spec.add_runtime_dependency 'emass_client', '~> 3.
|
32
|
+
spec.add_runtime_dependency 'emass_client', '~> 3.12'
|
33
33
|
|
34
34
|
spec.add_development_dependency 'bundler', '~> 2.3'
|
35
35
|
spec.add_development_dependency 'bundler-audit', '~> 0.7'
|
@@ -9,7 +9,7 @@ module Emasser
|
|
9
9
|
ENV.fetch(env) { raise Emasser::ConfigurationMissingError.new(env) }
|
10
10
|
rescue Emasser::ConfigurationMissingError => e
|
11
11
|
if (ARGV[0].to_s.include? '-v') || (ARGV[0].to_s.include? '-V')
|
12
|
-
puts "
|
12
|
+
puts "eMASSer version: #{Emasser::VERSION}".green
|
13
13
|
else
|
14
14
|
puts "\n", e.message.red
|
15
15
|
puts 'Create a .env file containing required variables, place it in the root directory where the emasser command is executed'.yellow
|
@@ -17,10 +17,10 @@ module Emasser
|
|
17
17
|
puts ' export EMASSER_API_KEY=<API key>'.green
|
18
18
|
puts ' export EMASSER_USER_UID=<unique identifier of the eMASS user EMASSER_API_KEY belongs to>'.green
|
19
19
|
puts ' export EMASSER_HOST_URL=<FQDN of the eMASS server>'.green
|
20
|
-
puts ' export EMASSER_KEY_FILE_PATH=<path to your
|
21
|
-
puts ' export EMASSER_CERT_FILE_PATH=<path to your
|
20
|
+
puts ' export EMASSER_KEY_FILE_PATH=<path to your eMASS key in PEM format>'.green
|
21
|
+
puts ' export EMASSER_CERT_FILE_PATH=<path to your eMASS certficate in PEM format>'.green
|
22
22
|
puts ' export EMASSER_KEY_FILE_PASSWORD=<password for the key given in EMASSER_KEY_FILE_PATH>'.green, "\n"
|
23
|
-
puts 'See
|
23
|
+
puts 'See eMASSer environment variables requirements in eMASSer CLI Features for more information (https://mitre.github.io/emasser/docs/features.html).', "\n"
|
24
24
|
end
|
25
25
|
exit
|
26
26
|
end
|
data/lib/emasser/constants.rb
CHANGED
data/lib/emasser/delete.rb
CHANGED
@@ -51,11 +51,11 @@ module Emasser
|
|
51
51
|
long_desc Help.text(:poam_del_mapper)
|
52
52
|
|
53
53
|
# Required parameters/fields
|
54
|
-
option :systemId, type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
55
|
-
option :poamId,
|
54
|
+
option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
55
|
+
option :poamId, aliases: '-p', type: :numeric, required: true, desc: 'A numeric value representing the poam identification'
|
56
56
|
|
57
57
|
def remove
|
58
|
-
body = EmassClient::
|
58
|
+
body = EmassClient::PoamRequestDeleteBodyInner.new
|
59
59
|
body.poam_id = options[:poamId]
|
60
60
|
body_array = Array.new(1, body)
|
61
61
|
|
@@ -80,26 +80,24 @@ module Emasser
|
|
80
80
|
long_desc Help.text(:milestone_del_mapper)
|
81
81
|
|
82
82
|
# Required parameters/fields
|
83
|
-
option :systemId,
|
83
|
+
option :systemId, aliases: '-s', type: :numeric, required: true,
|
84
84
|
desc: 'A numeric value representing the system identification'
|
85
|
-
option :poamId,
|
85
|
+
option :poamId, aliases: '-p', type: :numeric, required: true,
|
86
86
|
desc: 'A numeric value representing the poam identification'
|
87
|
-
option :milestoneId, type: :numeric, required: true,
|
87
|
+
option :milestoneId, aliases: '-m', type: :numeric, required: true,
|
88
88
|
desc: 'A numeric value representing the milestone identification'
|
89
89
|
|
90
90
|
def remove
|
91
|
-
body = EmassClient::
|
91
|
+
body = EmassClient::MilestonesRequestDeleteBodyInner.new
|
92
92
|
body.milestone_id = options[:milestoneId]
|
93
93
|
body_array = Array.new(1, body)
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
result = EmassClient::MilestonesApi.new.delete_milestone(options[:systemId], options[:poamId], body_array, opts)
|
95
|
+
result = EmassClient::MilestonesApi.new.delete_milestone(options[:systemId], options[:poamId], body_array)
|
96
|
+
# The server returns an empty object upon successfully deleting a milestone.
|
99
97
|
puts to_output_hash(result).green
|
100
98
|
rescue EmassClient::ApiError => e
|
101
99
|
puts 'Exception when calling MilestonesApi->delete_milestone'.red
|
102
|
-
puts to_output_hash(e)
|
100
|
+
puts to_output_hash(e)
|
103
101
|
end
|
104
102
|
end
|
105
103
|
|
@@ -113,11 +111,11 @@ module Emasser
|
|
113
111
|
end
|
114
112
|
|
115
113
|
desc 'remove', 'Delete one or many artifacts in a system'
|
116
|
-
long_desc Help.text(:
|
114
|
+
long_desc Help.text(:artifacts_del_mapper)
|
117
115
|
|
118
116
|
# Required parameters/fields
|
119
|
-
option :systemId, type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
120
|
-
option :files, type: :array, required: true, desc: 'Artifact file(s) to remove from the given system'
|
117
|
+
option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
118
|
+
option :files, aliases: '-f', type: :array, required: true, desc: 'Artifact file(s) to remove from the given system'
|
121
119
|
|
122
120
|
def remove
|
123
121
|
body_array = []
|
@@ -127,7 +125,7 @@ module Emasser
|
|
127
125
|
body_array << obj
|
128
126
|
end
|
129
127
|
|
130
|
-
result = EmassClient::ArtifactsApi.new.delete_artifact(options[:systemId]
|
128
|
+
result = EmassClient::ArtifactsApi.new.delete_artifact(body_array, options[:systemId])
|
131
129
|
puts to_output_hash(result).green
|
132
130
|
rescue EmassClient::ApiError => e
|
133
131
|
puts 'Exception when calling ArtifactsApi->delete_artifact'.red
|
@@ -135,6 +133,64 @@ module Emasser
|
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
136
|
+
# The Cloud Resource Results endpoint provides the ability to remove
|
137
|
+
# cloud resources and their scan results in the assets module for a system.
|
138
|
+
#
|
139
|
+
# Endpoint:
|
140
|
+
# /api/systems/{systemId}/cloud-resource-results - Remove one or many cloud resources in a system
|
141
|
+
class CloudResource < SubCommandBase
|
142
|
+
def self.exit_on_failure?
|
143
|
+
true
|
144
|
+
end
|
145
|
+
|
146
|
+
desc 'remove', 'Delete one or many Cloud Resources and their scan results in the assets module for a system'
|
147
|
+
|
148
|
+
# Required parameters/fields
|
149
|
+
option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
150
|
+
option :resourceId, aliases: '-c', type: :string, required: true, desc: 'Unique identifier/resource namespace for policy compliance result'
|
151
|
+
|
152
|
+
def remove
|
153
|
+
body = EmassClient::CloudResourcesDeleteBodyInner.new
|
154
|
+
body.resource_id = options[:resourceId]
|
155
|
+
body_array = Array.new(1, body)
|
156
|
+
|
157
|
+
result = EmassClient::CloudResourceResultsApi.new.delete_cloud_resources(options[:systemId], body_array)
|
158
|
+
puts to_output_hash(result).green
|
159
|
+
rescue EmassClient::ApiError => e
|
160
|
+
puts 'Exception when calling MilestonesApi->delete_cloud_resources'.red
|
161
|
+
puts to_output_hash(e)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
# The Container Scan Results endpoint provides the ability to remove
|
166
|
+
# containers and their scan results in the assets module for a system.
|
167
|
+
#
|
168
|
+
# Endpoint:
|
169
|
+
# /api/systems/{systemId}/container-scan-results - Remove one or many containers in a system
|
170
|
+
class Container < SubCommandBase
|
171
|
+
def self.exit_on_failure?
|
172
|
+
true
|
173
|
+
end
|
174
|
+
|
175
|
+
desc 'remove', 'Delete one or many containers scan results in the assets module for a system'
|
176
|
+
|
177
|
+
# Required parameters/fields
|
178
|
+
option :systemId, aliases: '-s', type: :numeric, required: true, desc: 'A numeric value representing the system identification'
|
179
|
+
option :containerId, aliases: '-c', type: :string, required: true, desc: 'Unique identifier of the container'
|
180
|
+
|
181
|
+
def remove
|
182
|
+
body = EmassClient::ContainerResourcesDeleteBodyInner.new
|
183
|
+
body.containerId = options[:containerId]
|
184
|
+
body_array = Array.new(1, body)
|
185
|
+
|
186
|
+
result = EmassClient::ContainerScanResultsApi.new.delete_container_sans(options[:systemId], body_array)
|
187
|
+
puts to_output_hash(result).green
|
188
|
+
rescue EmassClient::ApiError => e
|
189
|
+
puts 'Exception when calling MilestonesApi->delete_cloud_resources'.red
|
190
|
+
puts to_output_hash(e)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
138
194
|
class Delete < SubCommandBase
|
139
195
|
desc 'poams', 'Delete Plan of Action and Milestones (POA&M) items for a system'
|
140
196
|
subcommand 'poams', Poams
|
@@ -144,5 +200,11 @@ module Emasser
|
|
144
200
|
|
145
201
|
desc 'artifacts', 'Delete system Artifacts'
|
146
202
|
subcommand 'artifacts', Artifacts
|
203
|
+
|
204
|
+
desc 'cloud_resource', 'Delete cloud resource and their scan results'
|
205
|
+
subcommand 'cloud_resource', CloudResource
|
206
|
+
|
207
|
+
desc 'container', 'Delete container and their scan results'
|
208
|
+
subcommand 'container', Container
|
147
209
|
end
|
148
210
|
end
|