cyber_trackr_live 1.0.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 (38) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG-GEM.md +47 -0
  3. data/CODE_OF_CONDUCT.md +20 -0
  4. data/CONTRIBUTING.md +422 -0
  5. data/LICENSE.md +16 -0
  6. data/NOTICE.md +16 -0
  7. data/README-GEM.md +75 -0
  8. data/SECURITY.md +86 -0
  9. data/cyber_trackr_live.gemspec +56 -0
  10. data/examples/cyber_trackr_client.rb +208 -0
  11. data/examples/fetch-complete-stig +174 -0
  12. data/examples/fetch-stig-complete +67 -0
  13. data/examples/fetch-stig-direct +99 -0
  14. data/examples/use_helper.rb +50 -0
  15. data/lib/cyber_trackr_client/api/api_documentation_api.rb +79 -0
  16. data/lib/cyber_trackr_client/api/cci_api.rb +147 -0
  17. data/lib/cyber_trackr_client/api/documents_api.rb +276 -0
  18. data/lib/cyber_trackr_client/api/rmf_controls_api.rb +272 -0
  19. data/lib/cyber_trackr_client/api/scap_api.rb +276 -0
  20. data/lib/cyber_trackr_client/api_client.rb +437 -0
  21. data/lib/cyber_trackr_client/api_error.rb +58 -0
  22. data/lib/cyber_trackr_client/configuration.rb +400 -0
  23. data/lib/cyber_trackr_client/models/api_documentation.rb +238 -0
  24. data/lib/cyber_trackr_client/models/assessment_procedure.rb +321 -0
  25. data/lib/cyber_trackr_client/models/cci_detail.rb +391 -0
  26. data/lib/cyber_trackr_client/models/document_detail.rb +434 -0
  27. data/lib/cyber_trackr_client/models/document_version.rb +385 -0
  28. data/lib/cyber_trackr_client/models/error.rb +313 -0
  29. data/lib/cyber_trackr_client/models/requirement_detail.rb +580 -0
  30. data/lib/cyber_trackr_client/models/requirement_summary.rb +360 -0
  31. data/lib/cyber_trackr_client/models/rmf_control_detail.rb +436 -0
  32. data/lib/cyber_trackr_client/models/rmf_control_list.rb +241 -0
  33. data/lib/cyber_trackr_client/version.rb +15 -0
  34. data/lib/cyber_trackr_client.rb +54 -0
  35. data/lib/cyber_trackr_helper.rb +269 -0
  36. data/lib/rubocop/cop/cyber_trackr_api/README.md +81 -0
  37. data/openapi/openapi.yaml +798 -0
  38. metadata +271 -0
@@ -0,0 +1,580 @@
1
+ =begin
2
+ #Cyber Trackr API
3
+
4
+ #Complete OpenAPI 3.1.1 specification for cyber.trackr.live API. This API provides access to DISA STIGs, SRGs, RMF controls, CCIs, and SCAP data. ## DISA Cybersecurity Ecosystem Hierarchy ``` NIST RMF Controls (high-level policy framework) ↓ (decomposed into atomic, testable statements) CCIs (Control Correlation Identifiers - bridge policy to implementation) ↓ (grouped by technology class into generic requirements) SRGs (Security Requirements Guides - technology class \"what\" to do) ↓ (implemented as vendor-specific \"how\" to do it) STIGs (Security Technical Implementation Guides - vendor/product specific) ↓ (automated versions for scanning tools) SCAP (Security Content Automation Protocol documents) ``` ## Critical Relationships - **RMF Controls** contain assessment procedures that reference **CCIs** - **CCIs** map back to **RMF Controls** and forward to **STIG/SRG requirements** - **SRGs** define generic technology requirements that **STIGs** implement specifically - **V-IDs** can appear in both SRG and corresponding STIG (same requirement, different specificity) - **SV-IDs** are XCCDF rule identifiers with revision tracking across document releases
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module CyberTrackrClient
17
+ # Complete requirement details with implementation guidance
18
+ class RequirementDetail
19
+ attr_accessor :id
20
+
21
+ attr_accessor :rule
22
+
23
+ attr_accessor :severity
24
+
25
+ attr_accessor :requirement_title
26
+
27
+ attr_accessor :requirement_description
28
+
29
+ attr_accessor :mitigation_statement
30
+
31
+ attr_accessor :identifiers
32
+
33
+ attr_accessor :check_text
34
+
35
+ attr_accessor :fix_text
36
+
37
+ # Check procedure identifier
38
+ attr_accessor :check_id
39
+
40
+ # Fix procedure identifier
41
+ attr_accessor :fix_id
42
+
43
+ # Requirement group identifier
44
+ attr_accessor :group
45
+
46
+ # Requirement version
47
+ attr_accessor :version
48
+
49
+ # Parent STIG identifier
50
+ attr_accessor :stig
51
+
52
+ # Parent STIG title
53
+ attr_accessor :stig_title
54
+
55
+ # Parent STIG description
56
+ attr_accessor :stig_description
57
+
58
+ # Parent STIG publication date
59
+ attr_accessor :stig_published
60
+
61
+ # Parent STIG status
62
+ attr_accessor :stig_status
63
+
64
+ class EnumAttributeValidator
65
+ attr_reader :datatype
66
+ attr_reader :allowable_values
67
+
68
+ def initialize(datatype, allowable_values)
69
+ @allowable_values = allowable_values.map do |value|
70
+ case datatype.to_s
71
+ when /Integer/i
72
+ value.to_i
73
+ when /Float/i
74
+ value.to_f
75
+ else
76
+ value
77
+ end
78
+ end
79
+ end
80
+
81
+ def valid?(value)
82
+ !value || allowable_values.include?(value)
83
+ end
84
+ end
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'id' => :'id',
90
+ :'rule' => :'rule',
91
+ :'severity' => :'severity',
92
+ :'requirement_title' => :'requirement-title',
93
+ :'requirement_description' => :'requirement-description',
94
+ :'mitigation_statement' => :'mitigation-statement',
95
+ :'identifiers' => :'identifiers',
96
+ :'check_text' => :'check-text',
97
+ :'fix_text' => :'fix-text',
98
+ :'check_id' => :'check-id',
99
+ :'fix_id' => :'fix-id',
100
+ :'group' => :'group',
101
+ :'version' => :'version',
102
+ :'stig' => :'stig',
103
+ :'stig_title' => :'stig-title',
104
+ :'stig_description' => :'stig-description',
105
+ :'stig_published' => :'stig-published',
106
+ :'stig_status' => :'stig-status'
107
+ }
108
+ end
109
+
110
+ # Returns attribute mapping this model knows about
111
+ def self.acceptable_attribute_map
112
+ attribute_map
113
+ end
114
+
115
+ # Returns all the JSON keys this model knows about
116
+ def self.acceptable_attributes
117
+ acceptable_attribute_map.values
118
+ end
119
+
120
+ # Attribute type mapping.
121
+ def self.openapi_types
122
+ {
123
+ :'id' => :'String',
124
+ :'rule' => :'String',
125
+ :'severity' => :'String',
126
+ :'requirement_title' => :'String',
127
+ :'requirement_description' => :'String',
128
+ :'mitigation_statement' => :'String',
129
+ :'identifiers' => :'Array<String>',
130
+ :'check_text' => :'String',
131
+ :'fix_text' => :'String',
132
+ :'check_id' => :'String',
133
+ :'fix_id' => :'String',
134
+ :'group' => :'String',
135
+ :'version' => :'String',
136
+ :'stig' => :'String',
137
+ :'stig_title' => :'String',
138
+ :'stig_description' => :'String',
139
+ :'stig_published' => :'String',
140
+ :'stig_status' => :'String'
141
+ }
142
+ end
143
+
144
+ # List of attributes with nullable: true
145
+ def self.openapi_nullable
146
+ Set.new([
147
+ :'mitigation_statement',
148
+ ])
149
+ end
150
+
151
+ # Initializes the object
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ def initialize(attributes = {})
154
+ if (!attributes.is_a?(Hash))
155
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CyberTrackrClient::RequirementDetail` initialize method"
156
+ end
157
+
158
+ # check to see if the attribute exists and convert string to symbol for hash key
159
+ acceptable_attribute_map = self.class.acceptable_attribute_map
160
+ attributes = attributes.each_with_object({}) { |(k, v), h|
161
+ if (!acceptable_attribute_map.key?(k.to_sym))
162
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CyberTrackrClient::RequirementDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
163
+ end
164
+ h[k.to_sym] = v
165
+ }
166
+
167
+ if attributes.key?(:'id')
168
+ self.id = attributes[:'id']
169
+ else
170
+ self.id = nil
171
+ end
172
+
173
+ if attributes.key?(:'rule')
174
+ self.rule = attributes[:'rule']
175
+ else
176
+ self.rule = nil
177
+ end
178
+
179
+ if attributes.key?(:'severity')
180
+ self.severity = attributes[:'severity']
181
+ else
182
+ self.severity = nil
183
+ end
184
+
185
+ if attributes.key?(:'requirement_title')
186
+ self.requirement_title = attributes[:'requirement_title']
187
+ else
188
+ self.requirement_title = nil
189
+ end
190
+
191
+ if attributes.key?(:'requirement_description')
192
+ self.requirement_description = attributes[:'requirement_description']
193
+ end
194
+
195
+ if attributes.key?(:'mitigation_statement')
196
+ self.mitigation_statement = attributes[:'mitigation_statement']
197
+ end
198
+
199
+ if attributes.key?(:'identifiers')
200
+ if (value = attributes[:'identifiers']).is_a?(Array)
201
+ self.identifiers = value
202
+ end
203
+ end
204
+
205
+ if attributes.key?(:'check_text')
206
+ self.check_text = attributes[:'check_text']
207
+ else
208
+ self.check_text = nil
209
+ end
210
+
211
+ if attributes.key?(:'fix_text')
212
+ self.fix_text = attributes[:'fix_text']
213
+ else
214
+ self.fix_text = nil
215
+ end
216
+
217
+ if attributes.key?(:'check_id')
218
+ self.check_id = attributes[:'check_id']
219
+ end
220
+
221
+ if attributes.key?(:'fix_id')
222
+ self.fix_id = attributes[:'fix_id']
223
+ end
224
+
225
+ if attributes.key?(:'group')
226
+ self.group = attributes[:'group']
227
+ end
228
+
229
+ if attributes.key?(:'version')
230
+ self.version = attributes[:'version']
231
+ end
232
+
233
+ if attributes.key?(:'stig')
234
+ self.stig = attributes[:'stig']
235
+ end
236
+
237
+ if attributes.key?(:'stig_title')
238
+ self.stig_title = attributes[:'stig_title']
239
+ end
240
+
241
+ if attributes.key?(:'stig_description')
242
+ self.stig_description = attributes[:'stig_description']
243
+ end
244
+
245
+ if attributes.key?(:'stig_published')
246
+ self.stig_published = attributes[:'stig_published']
247
+ end
248
+
249
+ if attributes.key?(:'stig_status')
250
+ self.stig_status = attributes[:'stig_status']
251
+ end
252
+ end
253
+
254
+ # Show invalid properties with the reasons. Usually used together with valid?
255
+ # @return Array for valid properties with the reasons
256
+ def list_invalid_properties
257
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
258
+ invalid_properties = Array.new
259
+ if @id.nil?
260
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
261
+ end
262
+
263
+ pattern = Regexp.new(/^V-\d{6}$/)
264
+ if @id !~ pattern
265
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
266
+ end
267
+
268
+ if @rule.nil?
269
+ invalid_properties.push('invalid value for "rule", rule cannot be nil.')
270
+ end
271
+
272
+ pattern = Regexp.new(/^SV-\d+r\d+_rule$/)
273
+ if @rule !~ pattern
274
+ invalid_properties.push("invalid value for \"rule\", must conform to the pattern #{pattern}.")
275
+ end
276
+
277
+ if @severity.nil?
278
+ invalid_properties.push('invalid value for "severity", severity cannot be nil.')
279
+ end
280
+
281
+ if @requirement_title.nil?
282
+ invalid_properties.push('invalid value for "requirement_title", requirement_title cannot be nil.')
283
+ end
284
+
285
+ if @requirement_title.to_s.length < 1
286
+ invalid_properties.push('invalid value for "requirement_title", the character length must be greater than or equal to 1.')
287
+ end
288
+
289
+ if !@requirement_description.nil? && @requirement_description.to_s.length < 1
290
+ invalid_properties.push('invalid value for "requirement_description", the character length must be greater than or equal to 1.')
291
+ end
292
+
293
+ if @check_text.nil?
294
+ invalid_properties.push('invalid value for "check_text", check_text cannot be nil.')
295
+ end
296
+
297
+ if @check_text.to_s.length < 1
298
+ invalid_properties.push('invalid value for "check_text", the character length must be greater than or equal to 1.')
299
+ end
300
+
301
+ if @fix_text.nil?
302
+ invalid_properties.push('invalid value for "fix_text", fix_text cannot be nil.')
303
+ end
304
+
305
+ if @fix_text.to_s.length < 1
306
+ invalid_properties.push('invalid value for "fix_text", the character length must be greater than or equal to 1.')
307
+ end
308
+
309
+ invalid_properties
310
+ end
311
+
312
+ # Check to see if the all the properties in the model are valid
313
+ # @return true if the model is valid
314
+ def valid?
315
+ warn '[DEPRECATED] the `valid?` method is obsolete'
316
+ return false if @id.nil?
317
+ return false if @id !~ Regexp.new(/^V-\d{6}$/)
318
+ return false if @rule.nil?
319
+ return false if @rule !~ Regexp.new(/^SV-\d+r\d+_rule$/)
320
+ return false if @severity.nil?
321
+ severity_validator = EnumAttributeValidator.new('String', ["high", "medium", "low"])
322
+ return false unless severity_validator.valid?(@severity)
323
+ return false if @requirement_title.nil?
324
+ return false if @requirement_title.to_s.length < 1
325
+ return false if !@requirement_description.nil? && @requirement_description.to_s.length < 1
326
+ return false if @check_text.nil?
327
+ return false if @check_text.to_s.length < 1
328
+ return false if @fix_text.nil?
329
+ return false if @fix_text.to_s.length < 1
330
+ true
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] id Value to be assigned
335
+ def id=(id)
336
+ if id.nil?
337
+ fail ArgumentError, 'id cannot be nil'
338
+ end
339
+
340
+ pattern = Regexp.new(/^V-\d{6}$/)
341
+ if id !~ pattern
342
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
343
+ end
344
+
345
+ @id = id
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] rule Value to be assigned
350
+ def rule=(rule)
351
+ if rule.nil?
352
+ fail ArgumentError, 'rule cannot be nil'
353
+ end
354
+
355
+ pattern = Regexp.new(/^SV-\d+r\d+_rule$/)
356
+ if rule !~ pattern
357
+ fail ArgumentError, "invalid value for \"rule\", must conform to the pattern #{pattern}."
358
+ end
359
+
360
+ @rule = rule
361
+ end
362
+
363
+ # Custom attribute writer method checking allowed values (enum).
364
+ # @param [Object] severity Object to be assigned
365
+ def severity=(severity)
366
+ validator = EnumAttributeValidator.new('String', ["high", "medium", "low"])
367
+ unless validator.valid?(severity)
368
+ fail ArgumentError, "invalid value for \"severity\", must be one of #{validator.allowable_values}."
369
+ end
370
+ @severity = severity
371
+ end
372
+
373
+ # Custom attribute writer method with validation
374
+ # @param [Object] requirement_title Value to be assigned
375
+ def requirement_title=(requirement_title)
376
+ if requirement_title.nil?
377
+ fail ArgumentError, 'requirement_title cannot be nil'
378
+ end
379
+
380
+ if requirement_title.to_s.length < 1
381
+ fail ArgumentError, 'invalid value for "requirement_title", the character length must be greater than or equal to 1.'
382
+ end
383
+
384
+ @requirement_title = requirement_title
385
+ end
386
+
387
+ # Custom attribute writer method with validation
388
+ # @param [Object] requirement_description Value to be assigned
389
+ def requirement_description=(requirement_description)
390
+ if requirement_description.nil?
391
+ fail ArgumentError, 'requirement_description cannot be nil'
392
+ end
393
+
394
+ if requirement_description.to_s.length < 1
395
+ fail ArgumentError, 'invalid value for "requirement_description", the character length must be greater than or equal to 1.'
396
+ end
397
+
398
+ @requirement_description = requirement_description
399
+ end
400
+
401
+ # Custom attribute writer method with validation
402
+ # @param [Object] check_text Value to be assigned
403
+ def check_text=(check_text)
404
+ if check_text.nil?
405
+ fail ArgumentError, 'check_text cannot be nil'
406
+ end
407
+
408
+ if check_text.to_s.length < 1
409
+ fail ArgumentError, 'invalid value for "check_text", the character length must be greater than or equal to 1.'
410
+ end
411
+
412
+ @check_text = check_text
413
+ end
414
+
415
+ # Custom attribute writer method with validation
416
+ # @param [Object] fix_text Value to be assigned
417
+ def fix_text=(fix_text)
418
+ if fix_text.nil?
419
+ fail ArgumentError, 'fix_text cannot be nil'
420
+ end
421
+
422
+ if fix_text.to_s.length < 1
423
+ fail ArgumentError, 'invalid value for "fix_text", the character length must be greater than or equal to 1.'
424
+ end
425
+
426
+ @fix_text = fix_text
427
+ end
428
+
429
+ # Checks equality by comparing each attribute.
430
+ # @param [Object] Object to be compared
431
+ def ==(o)
432
+ return true if self.equal?(o)
433
+ self.class == o.class &&
434
+ id == o.id &&
435
+ rule == o.rule &&
436
+ severity == o.severity &&
437
+ requirement_title == o.requirement_title &&
438
+ requirement_description == o.requirement_description &&
439
+ mitigation_statement == o.mitigation_statement &&
440
+ identifiers == o.identifiers &&
441
+ check_text == o.check_text &&
442
+ fix_text == o.fix_text &&
443
+ check_id == o.check_id &&
444
+ fix_id == o.fix_id &&
445
+ group == o.group &&
446
+ version == o.version &&
447
+ stig == o.stig &&
448
+ stig_title == o.stig_title &&
449
+ stig_description == o.stig_description &&
450
+ stig_published == o.stig_published &&
451
+ stig_status == o.stig_status
452
+ end
453
+
454
+ # @see the `==` method
455
+ # @param [Object] Object to be compared
456
+ def eql?(o)
457
+ self == o
458
+ end
459
+
460
+ # Calculates hash code according to all attributes.
461
+ # @return [Integer] Hash code
462
+ def hash
463
+ [id, rule, severity, requirement_title, requirement_description, mitigation_statement, identifiers, check_text, fix_text, check_id, fix_id, group, version, stig, stig_title, stig_description, stig_published, stig_status].hash
464
+ end
465
+
466
+ # Builds the object from hash
467
+ # @param [Hash] attributes Model attributes in the form of hash
468
+ # @return [Object] Returns the model itself
469
+ def self.build_from_hash(attributes)
470
+ return nil unless attributes.is_a?(Hash)
471
+ attributes = attributes.transform_keys(&:to_sym)
472
+ transformed_hash = {}
473
+ openapi_types.each_pair do |key, type|
474
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
475
+ transformed_hash["#{key}"] = nil
476
+ elsif type =~ /\AArray<(.*)>/i
477
+ # check to ensure the input is an array given that the attribute
478
+ # is documented as an array but the input is not
479
+ if attributes[attribute_map[key]].is_a?(Array)
480
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
481
+ end
482
+ elsif !attributes[attribute_map[key]].nil?
483
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
484
+ end
485
+ end
486
+ new(transformed_hash)
487
+ end
488
+
489
+ # Deserializes the data based on type
490
+ # @param string type Data type
491
+ # @param string value Value to be deserialized
492
+ # @return [Object] Deserialized data
493
+ def self._deserialize(type, value)
494
+ case type.to_sym
495
+ when :Time
496
+ Time.parse(value)
497
+ when :Date
498
+ Date.parse(value)
499
+ when :String
500
+ value.to_s
501
+ when :Integer
502
+ value.to_i
503
+ when :Float
504
+ value.to_f
505
+ when :Boolean
506
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
507
+ true
508
+ else
509
+ false
510
+ end
511
+ when :Object
512
+ # generic object (usually a Hash), return directly
513
+ value
514
+ when /\AArray<(?<inner_type>.+)>\z/
515
+ inner_type = Regexp.last_match[:inner_type]
516
+ value.map { |v| _deserialize(inner_type, v) }
517
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
518
+ k_type = Regexp.last_match[:k_type]
519
+ v_type = Regexp.last_match[:v_type]
520
+ {}.tap do |hash|
521
+ value.each do |k, v|
522
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
523
+ end
524
+ end
525
+ else # model
526
+ # models (e.g. Pet) or oneOf
527
+ klass = CyberTrackrClient.const_get(type)
528
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
529
+ end
530
+ end
531
+
532
+ # Returns the string representation of the object
533
+ # @return [String] String presentation of the object
534
+ def to_s
535
+ to_hash.to_s
536
+ end
537
+
538
+ # to_body is an alias to to_hash (backward compatibility)
539
+ # @return [Hash] Returns the object in the form of hash
540
+ def to_body
541
+ to_hash
542
+ end
543
+
544
+ # Returns the object in the form of hash
545
+ # @return [Hash] Returns the object in the form of hash
546
+ def to_hash
547
+ hash = {}
548
+ self.class.attribute_map.each_pair do |attr, param|
549
+ value = self.send(attr)
550
+ if value.nil?
551
+ is_nullable = self.class.openapi_nullable.include?(attr)
552
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
553
+ end
554
+
555
+ hash[param] = _to_hash(value)
556
+ end
557
+ hash
558
+ end
559
+
560
+ # Outputs non-array value in the form of hash
561
+ # For object, use to_hash. Otherwise, just return the value
562
+ # @param [Object] value Any valid value
563
+ # @return [Hash] Returns the value in the form of hash
564
+ def _to_hash(value)
565
+ if value.is_a?(Array)
566
+ value.compact.map { |v| _to_hash(v) }
567
+ elsif value.is_a?(Hash)
568
+ {}.tap do |hash|
569
+ value.each { |k, v| hash[k] = _to_hash(v) }
570
+ end
571
+ elsif value.respond_to? :to_hash
572
+ value.to_hash
573
+ else
574
+ value
575
+ end
576
+ end
577
+
578
+ end
579
+
580
+ end