emasser 3.10.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.env-example +18 -12
  3. data/.github/workflows/anchore-syft.yml +38 -0
  4. data/.github/workflows/codeql-analysis.yml +4 -4
  5. data/.github/workflows/gh-pages.yml +1 -1
  6. data/.github/workflows/push-to-docker-mail.yml +6 -7
  7. data/.github/workflows/push-to-docker.yml +6 -6
  8. data/.github/workflows/release.yml +1 -1
  9. data/.github/workflows/rubocop.yml +2 -2
  10. data/.github/workflows/test-cli.yml +5 -5
  11. data/.mergify.yml +11 -11
  12. data/.rubocop.yml +1 -1
  13. data/CHANGELOG.md +58 -2
  14. data/Dockerfile +6 -4
  15. data/Gemfile.lock +108 -64
  16. data/README.md +23 -22
  17. data/docs/features.md +682 -539
  18. data/emasser.gemspec +19 -13
  19. data/images/emasser_architecture.png +0 -0
  20. data/lib/emasser/configuration.rb +136 -35
  21. data/lib/emasser/constants.rb +4 -4
  22. data/lib/emasser/delete.rb +145 -15
  23. data/lib/emasser/errors.rb +9 -0
  24. data/lib/emasser/get.rb +891 -251
  25. data/lib/emasser/help/approvalCac_post_mapper.md +6 -5
  26. data/lib/emasser/help/approvalPac_post_mapper.md +1 -5
  27. data/lib/emasser/help/artifacts_del_mapper.md +2 -2
  28. data/lib/emasser/help/artifacts_post_mapper.md +23 -34
  29. data/lib/emasser/help/artifacts_put_mapper.md +28 -9
  30. data/lib/emasser/help/cloudresource_post_mapper.md +4 -3
  31. data/lib/emasser/help/controls_put_mapper.md +24 -16
  32. data/lib/emasser/help/hardware_post_mapper.md +41 -0
  33. data/lib/emasser/help/hardware_put_mapper.md +42 -0
  34. data/lib/emasser/help/milestone_del_mapper.md +1 -1
  35. data/lib/emasser/help/milestone_post_mapper.md +3 -1
  36. data/lib/emasser/help/milestone_put_mapper.md +1 -8
  37. data/lib/emasser/help/poam_del_mapper.md +1 -1
  38. data/lib/emasser/help/poam_post_mapper.md +40 -14
  39. data/lib/emasser/help/poam_put_mapper.md +43 -18
  40. data/lib/emasser/help/software_post_mapper.md +59 -0
  41. data/lib/emasser/help/software_put_mapper.md +60 -0
  42. data/lib/emasser/help/staticcode_post_mapper.md +0 -4
  43. data/lib/emasser/help/testresults_post_mapper.md +8 -11
  44. data/lib/emasser/output_converters.rb +64 -46
  45. data/lib/emasser/post.rb +603 -231
  46. data/lib/emasser/put.rb +453 -193
  47. data/lib/emasser/version.rb +1 -1
  48. metadata +51 -33
  49. data/images/emasser_architecture.jpg +0 -0
  50. data/images/emasser_diagram-Page-3.jpg +0 -0
@@ -0,0 +1,59 @@
1
+ Endpoint request parameters/fields
2
+
3
+ Field Data Type Details
4
+ -------------------------------------------------------------------------------------------------
5
+ systemId Integer [Required] Unique eMASS identifier. Will need to provide correct number.
6
+ softwareVendor String [Required] Vendor of the software asset. Character Limit = 100.
7
+ softwareName String [Required] Name of the software asset. Character Limit = 100.
8
+ version String [Required] Version of the software asset. Character Limit = 100.
9
+
10
+ approvalDate Date [Conditional] Approval date of the software asset. If Approval Status is set to “Unapproved”
11
+ or “In Progress”, Approval Date will be set to null. Unix date format.
12
+
13
+ softwareType* String [Optional] Type of the software asset. Character Limit = 100.
14
+ parentSystem String [Optional] Parent system of the software asset. Character Limit = 100.
15
+ subsystem String [Optional] Subsystem of the software asset. Character Limit = 100.
16
+ network String [Optional] Network of the software asset. Character Limit = 100.
17
+ hostingEnvironment String [Optional] Hosting environment of the software asset. Character Limit = 100.
18
+ softwareDependencies String [Optional] Dependencies for the software asset. Character Limit = 100.
19
+ cryptographicHash String [Optional] Cryptographic hash for the software asset. Character Limit = 100.
20
+ inServiceData String [Optional] In service data for the software asset. Character Limit = 100.
21
+ itBudgetUii String [Optional] IT budget UII for the software asset. Character Limit = 50.
22
+ fiscalYear String [Optional] Fiscal year (FY) for the software asset. Character Limit = 20.
23
+ popEndDate Date [Optional] Period of performance (POP) end date for the software asset. Unix time format.
24
+ licenseOrContract String [Optional] License or contract for the software asset. Character Limit = 250.
25
+ licenseTerm String [Optional] License term for the software asset. Character Limit = 100.
26
+ costPerLicense Double [Optional] Cost per license for the software asset. Number will be converted to display 2 decimal points.
27
+ totalLicenses Integer [Optional] Number of total licenses for the software asset.
28
+ totalLicenseCost Double [Optional] Total cost of the licenses for the software asset. Number will be converted to display 2 decimal points.
29
+ licensesUsed Integer [Optional] Number of licenses used for the software asset.
30
+ licensePoc String [Optional] Point of contact (POC) for the software asset. Character Limit = 100.
31
+ licenseRenewalDate Date [Optional] License renewal date for the software asset. Unix date format.
32
+ licenseExpirationDate Date [Optional] License expiration date for the software asset. Unix date format.
33
+ approvalStatus** String [Optional] Approval status of the software asset. Character Limit = 100.
34
+ releaseDate Date [Optional] Release date of the software asset. Unix date format.
35
+ maintenanceDate Date [Optional] Maintenance date of the software asset. Unix date format.
36
+ retirementDate Date [Optional] Retirement date of the software asset. Unix date format.
37
+ endOfLifeSupportDate Date [Optional] End of life/support date of the software asset. Unix date format.
38
+ criticalAsset Boolean [Optional] Indicates whether the asset is a critical information system asset. The default value is false.
39
+ location String [Optional] Location of the software asset Character Limit = 250.
40
+ purpose String [Optional] Purpose of the software asset. Character Limit = 1,000.
41
+ extendedEndOfLifeSupportDate Date [Optional] If set, the Extended End of Life/Support Date cannot occur prior to the End of Life/Support Date. Unix date format.
42
+ unsupportedOperatingSystem Boolean [Optional] Unsupported operating system. VA only.
43
+ unapprovedSoftwareFromTrm Boolean [Optional] Unapproved software from TRM. VA only.
44
+ approvedWaiver Boolean [Optional] Approved waiver. VA only.
45
+
46
+
47
+ * Software Type - default values include the following options, however custom values can be entered to create new options:
48
+ COTS Application, GOTS Application, Office Automation, Security Application, Server Application, Web Application
49
+
50
+ ** Approval Status default values include the following options, however custom values can be entered to create new options:
51
+ Approved - DISA UC APL, Approved - FIPS 140-2, Approved - NIAP CCVES,
52
+ Approved - NSA Crypto, Approved - NSA CSfC, In Progress, Unapproved
53
+
54
+
55
+ Example:
56
+
57
+ bundle exec exe/emasser post software add [-s, --systemId] <value> [-V, --softwareVendor] <value> [-N, --softwareName] <value> [-v --version] <value>
58
+
59
+ Note: The example does not list any optional or conditional fields
@@ -0,0 +1,60 @@
1
+ Endpoint request parameters/fields
2
+
3
+ Field Data Type Details
4
+ -------------------------------------------------------------------------------------------------
5
+ systemId Integer [Required] Unique eMASS identifier. Will need to provide correct number.
6
+ softwareId String [Required] Unique software identifier.
7
+ softwareVendor String [Required] Vendor of the software asset. Character Limit = 100.
8
+ softwareName String [Required] Name of the software asset. Character Limit = 100.
9
+ version String [Required] Version of the software asset. Character Limit = 100.
10
+
11
+ approvalDate Date [Conditional] Approval date of the software asset. If Approval Status is set to “Unapproved”
12
+ or “In Progress”, Approval Date will be set to null. Unix date format.
13
+
14
+ softwareType* String [Optional] Type of the software asset. Character Limit = 100.
15
+ parentSystem String [Optional] Parent system of the software asset. Character Limit = 100.
16
+ subsystem String [Optional] Subsystem of the software asset. Character Limit = 100.
17
+ network String [Optional] Network of the software asset. Character Limit = 100.
18
+ hostingEnvironment String [Optional] Hosting environment of the software asset. Character Limit = 100.
19
+ softwareDependencies String [Optional] Dependencies for the software asset. Character Limit = 100.
20
+ cryptographicHash String [Optional] Cryptographic hash for the software asset. Character Limit = 100.
21
+ inServiceData String [Optional] In service data for the software asset. Character Limit = 100.
22
+ itBudgetUii String [Optional] IT budget UII for the software asset. Character Limit = 50.
23
+ fiscalYear String [Optional] Fiscal year (FY) for the software asset. Character Limit = 20.
24
+ popEndDate Date [Optional] Period of performance (POP) end date for the software asset. Unix time format.
25
+ licenseOrContract String [Optional] License or contract for the software asset. Character Limit = 250.
26
+ licenseTerm String [Optional] License term for the software asset. Character Limit = 100.
27
+ costPerLicense Double [Optional] Cost per license for the software asset. Number will be converted to display 2 decimal points.
28
+ totalLicenses Integer [Optional] Number of total licenses for the software asset.
29
+ totalLicenseCost Double [Optional] Total cost of the licenses for the software asset. Number will be converted to display 2 decimal points.
30
+ licensesUsed Integer [Optional] Number of licenses used for the software asset.
31
+ licensePoc String [Optional] Point of contact (POC) for the software asset. Character Limit = 100.
32
+ licenseRenewalDate Date [Optional] License renewal date for the software asset. Unix date format.
33
+ licenseExpirationDate Date [Optional] License expiration date for the software asset. Unix date format.
34
+ approvalStatus** String [Optional] Approval status of the software asset. Character Limit = 100.
35
+ releaseDate Date [Optional] Release date of the software asset. Unix date format.
36
+ maintenanceDate Date [Optional] Maintenance date of the software asset. Unix date format.
37
+ retirementDate Date [Optional] Retirement date of the software asset. Unix date format.
38
+ endOfLifeSupportDate Date [Optional] End of life/support date of the software asset. Unix date format.
39
+ criticalAsset Boolean [Optional] Indicates whether the asset is a critical information system asset. The default value is false.
40
+ location String [Optional] Location of the software asset Character Limit = 250.
41
+ purpose String [Optional] Purpose of the software asset. Character Limit = 1,000.
42
+ extendedEndOfLifeSupportDate Date [Optional] If set, the Extended End of Life/Support Date cannot occur prior to the End of Life/Support Date. Unix date format.
43
+ unsupportedOperatingSystem Boolean [Optional] Unsupported operating system. VA only.
44
+ unapprovedSoftwareFromTrm Boolean [Optional] Unapproved software from TRM. VA only.
45
+ approvedWaiver Boolean [Optional] Approved waiver. VA only.
46
+
47
+
48
+ * Software Type - default values include the following options, however custom values can be entered to create new options:
49
+ COTS Application, GOTS Application, Office Automation, Security Application, Server Application, Web Application
50
+
51
+ ** Approval Status default values include the following options, however custom values can be entered to create new options:
52
+ Approved - DISA UC APL, Approved - FIPS 140-2, Approved - NIAP CCVES,
53
+ Approved - NSA Crypto, Approved - NSA CSfC, In Progress, Unapproved
54
+
55
+
56
+ Example:
57
+
58
+ bundle exec exe/emasser post software update [-s, --systemId] <value> [-S --softwareId] <value> [-V, --softwareVendor] <value> [-N, --softwareName] <value> [-v --version] <value>
59
+
60
+ Note: The example does not list any optional or conditional fields
@@ -11,10 +11,6 @@ codeCheckName String [Required] Name of the software vulnerability
11
11
  scanDate Integer [Required] The findings scan date - Unix time format
12
12
  cweId String [Required] The Common Weakness Enumerator (CWE) identifier
13
13
 
14
- rawSeverity* String [Optional] Values include the following: (Low, Medium, Moderate, High, Critical)
15
- count Integer [Optional] Number of instances observed for a specified finding
16
-
17
- *rawSeverity: In eMASS, values of "Critical" will appear as "Very High", and values of “Medium” will appear as "Moderate". Any values not listed as options in the list above will map to “Unknown” and appear as blank values.
18
14
 
19
15
  Example:
20
16
 
@@ -2,20 +2,17 @@ Endpoint request body parameters/fields
2
2
 
3
3
  Field Data Type Details
4
4
  -------------------------------------------------------------------------------------------------
5
- systemId Integer [Required] Unique eMASS identifier. Will need to provide correct number
6
- cci String [Required] CCI associated with the test result.
7
- isInherited Boolean [Read-Only] Indicates whether a test result is inherited.
8
- testedBy String [Required] Last Name, First Name. 100 Characters.
9
- testDate Date [Required] Unix time format.
10
- description String [Required] Include description of test result. 4000 Characters.
11
- type String [Read-Only] Indicates the location in the Control Approval Chain when the test result is submitted.
12
- complianceStatus String [Required] Values include the following: (Compliant, Non-Compliant, Not Applicable)
5
+ systemId Integer [Required] Unique eMASS identifier. Will need to provide correct number
6
+ assessmentProcedure String [Required] The Security Control Assessment Procedure being assessed.
7
+ testedBy String [Required] Last Name, First Name. 100 Characters.
8
+ testDate Date [Required] Unix time format.
9
+ description String [Required] Include description of test result. 4000 Characters.
10
+ complianceStatus String [Required] Values include the following: (Compliant, Non-Compliant, Not Applicable)
13
11
 
14
- control String [Read-Only] Control acronym associated with the test result. NIST SP 800-53 Revision 4 defined.
15
12
 
16
13
  Example:
17
14
 
18
- bundle exec exe/emasser post test_results add --systemId [value] --cci [value] --testedBy [value] --testDate [value] --description [value] --complianceStatus [value]
15
+ bundle exec exe/emasser post test_results add [-s --systemId] <value> --assessmentProcedure <value> --testedBy <value> --testDate <value? --description <value> --complianceStatus <value>
19
16
 
20
- Note: If no POA&Ms or AP exist for the control (system), you will get this response:
17
+ Note: If no POA&Ms or Assessment Procedure exist for the control (system), you will get this response:
21
18
  "You have entered a Non-Compliant Test Result. You must create a POA&M Item for this Control and/or AP if one does not already exist."
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OutputConverters
4
4
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Style/TernaryParentheses
5
- # rubocop:disable Style/IfWithBooleanLiteralBranches, Style/RescueStandardError, Metrics/BlockNesting
5
+ # rubocop:disable Style/IfWithBooleanLiteralBranches, Style/RescueStandardError, Metrics/BlockNesting, Style/RedundantCondition
6
6
  def to_output_hash(obj)
7
7
  diplay_nulls = (ENV.fetch('EMASSER_CLI_DISPLAY_NULL', 'true').eql? 'true') ? true : false
8
8
  diplay_datetime = (ENV.fetch('EMASSER_EPOCH_TO_DATETIME', 'false').eql? 'true') ? true : false
@@ -20,66 +20,76 @@ module OutputConverters
20
20
  if !diplay_nulls
21
21
  clean_obj = {}
22
22
  data_obj = {}
23
- obj.each do |key, value|
24
- if key.to_s.include?('meta')
25
- obj_entry = {}
26
- obj_entry[:meta] = value
27
- clean_obj.merge!(obj_entry)
28
- elsif key.to_s.include?('data')
29
- if value.is_a?(Array)
30
- hash_array = []
31
- value.each do |elements|
32
- hash_array << elements.compact
23
+ begin
24
+ obj.each do |key, value|
25
+ if key.to_s.include?('meta')
26
+ obj_entry = {}
27
+ obj_entry[:meta] = value
28
+ clean_obj.merge!(obj_entry)
29
+ elsif key.to_s.include?('data')
30
+ if value.is_a?(Array)
31
+ hash_array = []
32
+ value.map do |elements|
33
+ hash_array << elements.compact
34
+ end
35
+ data_obj['data'] = hash_array
36
+ else
37
+ data_obj['data'] = value.nil? ? value : value.compact
33
38
  end
34
- data_obj['data'] = hash_array
35
- else
36
- data_obj['data'] = value.nil? ? value : value.compact
39
+ elsif key.to_s.include?('pagination')
40
+ pg_obj = {}
41
+ pg_obj[:pagination] = value
42
+ data_obj.merge!(pg_obj)
37
43
  end
38
- elsif key.to_s.include?('pagination')
39
- pg_obj = {}
40
- pg_obj[:pagination] = value
41
- data_obj.merge!(pg_obj)
44
+ clean_obj.merge!(data_obj)
42
45
  end
43
- clean_obj.merge!(data_obj)
46
+ obj = clean_obj
47
+ rescue
48
+ obj
44
49
  end
45
- obj = clean_obj
46
50
  end
47
51
 
48
52
  if diplay_datetime
49
53
  clean_obj = {}
50
54
  data_obj = {}
51
- obj.each do |key, value|
52
- if key.to_s.include?('meta')
53
- obj_entry = {}
54
- obj_entry[:meta] = value
55
- clean_obj.merge!(obj_entry)
56
- elsif key.to_s.include?('data')
57
- if value.is_a?(Array)
58
- hash_array = []
59
- value.each do |element|
60
- datetime_obj = change_to_datetime(element)
61
- hash_array << datetime_obj
55
+ begin
56
+ obj.each do |key, value|
57
+ if key.to_s.include?('meta')
58
+ obj_entry = {}
59
+ obj_entry[:meta] = value
60
+ clean_obj.merge!(obj_entry)
61
+ elsif key.to_s.include?('data')
62
+ if value.is_a?(Array)
63
+ hash_array = []
64
+ value.each do |element|
65
+ datetime_obj = change_to_datetime(element)
66
+ hash_array << datetime_obj
67
+ end
68
+ data_obj['data'] = hash_array
69
+ else
70
+ data_obj['data'] = change_to_datetime(value)
62
71
  end
63
- data_obj['data'] = hash_array
64
- else
65
- data_obj['data'] = change_to_datetime(value)
72
+ elsif key.to_s.include?('pagination')
73
+ pg_obj = {}
74
+ pg_obj[:pagination] = value
75
+ data_obj.merge!(pg_obj)
66
76
  end
67
- elsif key.to_s.include?('pagination')
68
- pg_obj = {}
69
- pg_obj[:pagination] = value
70
- data_obj.merge!(pg_obj)
77
+ clean_obj.merge!(data_obj)
71
78
  end
72
- clean_obj.merge!(data_obj)
79
+ obj = clean_obj
80
+ rescue
81
+ obj
73
82
  end
74
- obj = clean_obj
75
83
  end
76
84
  JSON.pretty_generate(obj)
77
85
  end
78
86
  end
79
87
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Style/TernaryParentheses
80
- # rubocop:enable Style/IfWithBooleanLiteralBranches, Style/RescueStandardError, Metrics/BlockNesting
88
+ # rubocop:enable Style/IfWithBooleanLiteralBranches, Style/RescueStandardError, Metrics/BlockNesting, Style/RedundantCondition
81
89
 
90
+ # rubocop:disable Style/RedundantReturn
82
91
  # rubocop:disable Style/IdenticalConditionalBranches
92
+ # rubocop:disable Metrics/BlockNesting, Style/RescueStandardError
83
93
  # rubocop:disable Performance/RedundantMatch, Performance/RegexpMatch
84
94
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
85
95
  def change_to_datetime(obj)
@@ -92,24 +102,32 @@ module OutputConverters
92
102
  obj_entry = {}
93
103
  if value.is_a?(Array)
94
104
  hash_array = []
95
- value.each do |element|
105
+ value.map do |element|
96
106
  hash_array << change_to_datetime(element)
97
107
  end
98
108
  obj_entry[key] = hash_array
99
109
  data_obj.merge!(obj_entry)
100
110
  else
111
+ date_value = value
101
112
  if /(DATE|TIMESTAMP|LASTSEEN|TIME|ATD)/.match(key.to_s.upcase)
102
- value = value.nil? ? value : Time.at(value.to_i)
113
+ begin
114
+ date_value = Integer(value)
115
+ if date_value > 100000000
116
+ date_value = value.nil? ? value : Time.at(date_value)
117
+ end
118
+ rescue
119
+ date_value
120
+ end
103
121
  end
104
- obj_entry[key] = value
122
+ obj_entry[key] = date_value
105
123
  data_obj.merge!(obj_entry)
106
124
  end
107
125
  end
108
- # rubocop:disable Style/RedundantReturn
109
126
  return data_obj
110
- # rubocop:enable Style/RedundantReturn
111
127
  end
128
+ # rubocop:enable Style/RedundantReturn
112
129
  # rubocop:enable Style/IdenticalConditionalBranches
130
+ # rubocop:enable Metrics/BlockNesting, Style/RescueStandardError
113
131
  # rubocop:enable Performance/RedundantMatch, Performance/RegexpMatch
114
132
  # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
115
133
  end