heimdall_tools 1.3.42 → 1.3.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 938eedc5f080d2ffca3623fd3f25c8996244009cc65aa4b78981ee8310063052
4
- data.tar.gz: '0588206839c8f454134354721e3d850859e59c0fab8d964c4eb40a9987930443'
3
+ metadata.gz: c43f6e237587993013cf521088d30cc83404ff141ec8b172ae8562bd8a48d977
4
+ data.tar.gz: e9ee689580ae95807ca329d086228f3ded50b2e6a162276e0d2d222729c42767
5
5
  SHA512:
6
- metadata.gz: f6b1a7071a33b8d54d2336ce715c67bff26fb1a02306612cb63d752553cd9758ce05274b37c62c4887a0746772c100772fba9d38abded9099ed14862726d5f90
7
- data.tar.gz: 1c752004ea7dde9a7695bb68d4e4a71839821afdf4032e6561bf0d119b2ee108dc131ace3b78382cab517afdfa19699f69a34b155faa546f4effa0c9fb658933
6
+ metadata.gz: 9d4880095e40720edc57619f79c5dd8a4000be7c16e9be8395e23057f3cd4f33844bea39c7d5f7814fbf9553b903057faf3ae49792f2f7fca4e0e89368ae4ad3
7
+ data.tar.gz: 95395b98c52a5854ca5115e3fea4159ccab351445a4a79fa241ecdc2c60f0f41b86f1328476b62594f3eb5d56bd02dc727b4172878a5aac8db38803318b6328d
@@ -38,8 +38,8 @@ module HeimdallTools
38
38
  def to_hdf
39
39
  controls = @issues.map do |issue|
40
40
  @item = {}
41
- @item['id'] = issue[:config_rule_name]
42
- @item['title'] = issue[:config_rule_name]
41
+ @item['id'] = issue[:config_rule_id]
42
+ @item['title'] = "#{get_account_id(issue[:config_rule_arn])} - #{issue[:config_rule_name]}"
43
43
  @item['desc'] = issue[:description]
44
44
  @item['impact'] = 0.5
45
45
  @item['tags'] = hdf_tags(issue)
@@ -55,6 +55,7 @@ module HeimdallTools
55
55
  @item
56
56
  end
57
57
  end
58
+
58
59
  results = HeimdallDataFormat.new(
59
60
  profile_name: 'AWS Config',
60
61
  title: 'AWS Config',
@@ -67,6 +68,20 @@ module HeimdallTools
67
68
 
68
69
  private
69
70
 
71
+ ##
72
+ # Gets the account ID from a config rule ARN
73
+ #
74
+ # https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
75
+ # https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html
76
+ #
77
+ # Params:
78
+ # - arn: The ARN of the config rule
79
+ #
80
+ # Returns: The account ID portion of the ARN
81
+ def get_account_id(arn)
82
+ /:(\d{12}):config-rule/.match(arn)&.captures&.first || 'no-account-id'
83
+ end
84
+
70
85
  ##
71
86
  # Read in a config rule -> 800-53 control mapping CSV.
72
87
  #
@@ -263,7 +278,8 @@ module HeimdallTools
263
278
  # If no input parameters, then provide an empty JSON array to the JSON
264
279
  # parser because passing nil to JSON.parse throws an exception.
265
280
  params = (JSON.parse(config_rule[:input_parameters] || '[]').map { |key, value| "#{key}: #{value}" }).join('<br/>')
266
- check_text = config_rule[:config_rule_arn] || ''
281
+ check_text = "ARN: #{config_rule[:config_rule_arn] || 'N/A'}"
282
+ check_text += "<br/>Source Identifier: #{config_rule.dig(:source, :source_identifier) || 'N/A'}"
267
283
  check_text += "<br/>#{params}" unless params.empty?
268
284
  check_text
269
285
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heimdall_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.42
4
+ version: 1.3.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Thew
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-04-08 00:00:00.000000000 Z
13
+ date: 2021-04-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk-configservice
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubygems_version: 3.2.3
265
+ rubygems_version: 3.2.15
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: Convert Forify, Openzap and Sonarqube results to HDF