Class: SecurityPentestPlanner::Planner

Inherits:
Object
  • Object
show all
Defined in:
lib/security_pentest_planner/planner.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  team: nil,
  scope: nil,
  include_datalake: false,
  api_layer: "API",
  data_layer: "Data Lake"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(input_path: nil, spec: nil, **options) ⇒ Planner

Returns a new instance of Planner.



13
14
15
16
17
# File 'lib/security_pentest_planner/planner.rb', line 13

def initialize(input_path: nil, spec: nil, **options)
  @input_path = input_path
  @spec = spec
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Method Details

#callObject

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/security_pentest_planner/planner.rb', line 19

def call
  parser = build_parser
  analyzer = ContractAnalyzer.new(
    parser,
    scope_paths: options[:scope],
    include_datalake: options[:include_datalake]
  )

  raise InputError, "Nenhum endpoint encontrado no escopo informado." if analyzer.scoped_endpoints.empty?

  vectors = VectorCatalog.vectors_for(analyzer)
  raise InputError, "Nenhum vetor aplicável encontrado para os sinais detectados." if vectors.empty?

  PlanRenderer.new(
    analyzer: analyzer,
    vectors: vectors,
    team: options[:team],
    api_layer: options[:api_layer],
    data_layer: options[:data_layer]
  ).render
end