dradis-plugins 4.18.0 → 4.19.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbaa602efa4365bbb53bf83b1df8bf5f7c94bb6f94f51eb06cad4aa760277a8b
4
- data.tar.gz: 6c293688ca05a8e93cb98577da607ecce2ab5d640520247cff5e0d07082ffdad
3
+ metadata.gz: 71b6ed361bb7be89c9866b89c5aaf0f07dcea637453c80db034d84f53e4baac5
4
+ data.tar.gz: 11db1abdc7c169d147c2a2445e9ce277568103579c9d9435b30fbe1a978fe19f
5
5
  SHA512:
6
- metadata.gz: 24a773a0dc01c78b3634cb53ccbdc81e0b53cdbbd8e2986dd046777bf140b5be65c98a6e4cf5216d65721c58dcec6bc83eeee46c04d793052daee1eb41cb573c
7
- data.tar.gz: 9d6a29c5e175ed04e3faaf53304708651a8c0cd4898486d13b9a0c2d17ca8c3ceb9bc0b594c0c9930630efe52631dedab210d798d9d92adb25ca5b738ebf9a0e
6
+ metadata.gz: c3457901aaadbd6ff208f087dcb10e36faae4d54a2d2f4ce2dcd708c4ee732b9fef857c8e62c2551b98a641956d29f2e900c221657d34265009cbcb80f068639
7
+ data.tar.gz: be6a12a20cd48e49f54ba69e7b176cf1891ecc61091d0db620c9e6b5285d6bc87f290887c05ab5819ea58df5509598cc79f40f6378e3798f7cce3ed04787c58c
data/.rubocop.yml ADDED
@@ -0,0 +1,129 @@
1
+ AllCops:
2
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
3
+ # to ignore them, so only the ones explicitly set in this file are enabled.
4
+ DisabledByDefault: true
5
+ SuggestExtensions: false
6
+ Exclude:
7
+ - '**/templates/**/*'
8
+
9
+ # Prefer &&/|| over and/or.
10
+ Style/AndOr:
11
+ Enabled: true
12
+
13
+ # Do not use braces for hash literals when they are the last argument of a
14
+ # method call.
15
+ Style/HashAsLastArrayItem:
16
+ Enabled: true
17
+
18
+ # Align `when` with `case`.
19
+ Layout/CaseIndentation:
20
+ Enabled: true
21
+
22
+ # Align comments with method definitions.
23
+ Layout/CommentIndentation:
24
+ Enabled: true
25
+
26
+ Layout/EmptyLineAfterMagicComment:
27
+ Enabled: true
28
+
29
+ # No extra empty lines.
30
+ Layout/EmptyLines:
31
+ Enabled: true
32
+
33
+ # In a regular class definition, no empty lines around the body.
34
+ Layout/EmptyLinesAroundClassBody:
35
+ Enabled: true
36
+
37
+ # In a regular method definition, no empty lines around the body.
38
+ Layout/EmptyLinesAroundMethodBody:
39
+ Enabled: true
40
+
41
+ # In a regular module definition, no empty lines around the body.
42
+ Layout/EmptyLinesAroundModuleBody:
43
+ Enabled: true
44
+
45
+ Layout/FirstArgumentIndentation:
46
+ Enabled: true
47
+
48
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
49
+ Style/HashSyntax:
50
+ Enabled: true
51
+ EnforcedShorthandSyntax: never
52
+
53
+ # Method definitions after `private` or `protected` isolated calls need one
54
+ # extra level of indentation.
55
+ Layout/IndentationConsistency:
56
+ Enabled: true
57
+ EnforcedStyle: normal
58
+
59
+ # Two spaces, no tabs (for indentation).
60
+ Layout/IndentationWidth:
61
+ Enabled: true
62
+
63
+ Layout/SpaceAfterColon:
64
+ Enabled: true
65
+
66
+ Layout/SpaceAfterComma:
67
+ Enabled: true
68
+
69
+ Layout/SpaceAroundEqualsInParameterDefault:
70
+ Enabled: true
71
+
72
+ Layout/SpaceAroundKeyword:
73
+ Enabled: true
74
+
75
+ Layout/SpaceAroundOperators:
76
+ Enabled: true
77
+
78
+ Layout/SpaceBeforeFirstArg:
79
+ Enabled: true
80
+
81
+ # Defining a method with parameters needs parentheses.
82
+ Style/MethodDefParentheses:
83
+ Enabled: true
84
+
85
+ # Use `foo {}` not `foo{}`.
86
+ Layout/SpaceBeforeBlockBraces:
87
+ Enabled: true
88
+
89
+ # Use `foo { bar }` not `foo {bar}`.
90
+ Layout/SpaceInsideBlockBraces:
91
+ Enabled: true
92
+
93
+ # Use `{ a: 1 }` not `{a:1}`.
94
+ Layout/SpaceInsideHashLiteralBraces:
95
+ Enabled: true
96
+
97
+ Layout/SpaceInsideParens:
98
+ Enabled: true
99
+
100
+ # Check quotes usage according to lint rule below.
101
+ Style/StringLiterals:
102
+ Enabled: true
103
+ EnforcedStyle: single_quotes
104
+
105
+ # Detect hard tabs, no hard tabs.
106
+ Layout/IndentationStyle:
107
+ Enabled: true
108
+
109
+ # Blank lines should not have any spaces.
110
+ Layout/TrailingEmptyLines:
111
+ Enabled: true
112
+
113
+ # No trailing whitespace.
114
+ Layout/TrailingWhitespace:
115
+ Enabled: true
116
+
117
+ # Use quotes for string literals when they are enough.
118
+ Style/RedundantPercentQ:
119
+ Enabled: true
120
+
121
+ # Align `end` with the matching keyword or starting expression except for
122
+ # assignments, where it should be aligned with the LHS.
123
+ Layout/EndAlignment:
124
+ Enabled: true
125
+ EnforcedStyleAlignWith: variable
126
+
127
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
128
+ Lint/RequireParentheses:
129
+ Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ v4.19.0 (November 2025)
2
+ - Add state attribute to Result class
3
+
1
4
  v4.18.0 (September 2025)
2
5
  - Update File.exists? calls for ruby upgrade
3
6
 
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
- require "bundler/gem_tasks"
2
-
1
+ require 'bundler/gem_tasks'
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler', '~> 2.0'
23
23
  spec.add_development_dependency 'rake'
24
24
  spec.add_development_dependency 'rspec-rails'
25
+ spec.add_development_dependency 'rubocop', '1.79.0'
25
26
  end
@@ -23,6 +23,6 @@ module Dradis::Plugins::ContentService
23
23
  include Notes
24
24
  include Properties if defined?(Dradis::Pro)
25
25
 
26
- ActiveSupport.run_load_hooks(:content_service, self)
26
+ ActiveSupport.run_load_hooks(:content_service, self)
27
27
  end
28
28
  end
@@ -10,7 +10,7 @@ module Dradis::Plugins::ContentService
10
10
  project.methodology_library.boards
11
11
  end
12
12
 
13
- def create_board(args={})
13
+ def create_board(args = {})
14
14
  name = args.fetch(:name, default_board_name)
15
15
  node_id = args.fetch(:node_id, default_node_id)
16
16
  Board.create(
@@ -13,7 +13,7 @@ module Dradis::Plugins::ContentService
13
13
  end
14
14
  end
15
15
 
16
- def create_content_block(args={})
16
+ def create_content_block(args = {})
17
17
  block_group = args.fetch(:block_group, default_content_block_group)
18
18
  content = args.fetch(:content, default_content_block_content)
19
19
  state = args.fetch(:state, :published)
@@ -11,7 +11,7 @@ module Dradis::Plugins::ContentService
11
11
 
12
12
  # @option plugin [Class] the 'wrapper' module of a plugin, e.g.
13
13
  # Dradis::Plugins::Nessus
14
- def initialize(args={})
14
+ def initialize(args = {})
15
15
  @logger = args.fetch(:logger, Rails.logger)
16
16
  @plugin = args.fetch(:plugin)
17
17
  @project = args[:project]
@@ -25,14 +25,14 @@ module Dradis::Plugins::ContentService
25
25
  @default_author ||= "#{plugin::Engine.plugin_name.to_s.humanize} upload plugin"
26
26
  end
27
27
 
28
- def try_rescue_from_length_validation(args={})
28
+ def try_rescue_from_length_validation(args = {})
29
29
  model = args[:model]
30
30
  field = args[:field]
31
31
  text = args[:text]
32
32
  msg = args[:msg]
33
- tail = "..." + args[:tail].to_s
33
+ tail = '...' + args[:tail].to_s
34
34
 
35
- logger.error{ "Trying to rescue from a :length error" }
35
+ logger.error { 'Trying to rescue from a :length error' }
36
36
 
37
37
  if model.errors[field]
38
38
  # the plugin tried to store too much information
@@ -2,7 +2,7 @@ module Dradis::Plugins::ContentService
2
2
  module Evidence
3
3
  extend ActiveSupport::Concern
4
4
 
5
- def create_evidence(args={})
5
+ def create_evidence(args = {})
6
6
  content = args.fetch(:content, default_evidence_content)
7
7
  node = args.fetch(:node, default_node_parent)
8
8
  issue = args[:issue] || default_evidence_issue
@@ -16,7 +16,7 @@ module Dradis::Plugins::ContentService
16
16
  issues.where(category_id: default_issue_category.id)
17
17
  end
18
18
 
19
- def create_issue(args={})
19
+ def create_issue(args = {})
20
20
  text = args.fetch(:text, default_issue_text)
21
21
  # NOTE that ID is the unique issue identifier assigned by the plugin,
22
22
  # and is not to be confused with the Issue#id primary key
@@ -88,7 +88,6 @@ module Dradis::Plugins::ContentService
88
88
  end
89
89
  end
90
90
 
91
-
92
91
  private
93
92
 
94
93
  def default_issue_category
@@ -17,7 +17,7 @@ module Dradis::Plugins::ContentService
17
17
  nodes.sort_by! { |node| node.label.split('.').map(&:to_i) }
18
18
  end
19
19
 
20
- def create_node(args={})
20
+ def create_node(args = {})
21
21
  label = args[:label] || default_node_label
22
22
  parent = args[:parent] || default_node_parent
23
23
 
@@ -59,7 +59,6 @@ module Dradis::Plugins::ContentService
59
59
  @default_node_type ||= Node::Types::DEFAULT
60
60
  end
61
61
 
62
-
63
62
  # Private: this method returns a list of nodes associated with Evidence
64
63
  # instances. When a node is affected by multiple issues, or multiple pieces
65
64
  # of evidence, we just want a single reference to it.
@@ -6,7 +6,7 @@ module Dradis::Plugins::ContentService
6
6
  project.notes.where(category: Category.report)
7
7
  end
8
8
 
9
- def create_note(args={})
9
+ def create_note(args = {})
10
10
  cat = args.fetch(:category, default_note_category)
11
11
  node = args.fetch(:node, default_node_parent)
12
12
  text = args.fetch(:text, default_note_text)
@@ -5,7 +5,7 @@ module Dradis
5
5
 
6
6
  config.dradis = ActiveSupport::OrderedOptions.new
7
7
 
8
- initializer "dradis-plugins.set_configs" do |app|
8
+ initializer 'dradis-plugins.set_configs' do |app|
9
9
  options = app.config.dradis
10
10
  options.base_export_controller_class_name ||= 'AuthenticatedController'
11
11
  options.thor_helper_module ||= Dradis::Plugins::ThorHelper
@@ -7,7 +7,7 @@ module Dradis
7
7
  class Base
8
8
  attr_accessor :content_service, :logger, :options, :plugin, :project, :scope
9
9
 
10
- def initialize(args={})
10
+ def initialize(args = {})
11
11
  # Save everything just in case the implementing class needs any of it.
12
12
  @options = args
13
13
 
@@ -22,12 +22,12 @@ module Dradis
22
22
  post_initialize(args)
23
23
  end
24
24
 
25
- def export(args={})
25
+ def export(args = {})
26
26
  raise "The export() method is not implemented in this plugin [#{self.class.name}]."
27
27
  end
28
28
 
29
29
  # This method can be overwriten by plugins to do initialization tasks.
30
- def post_initialize(args={})
30
+ def post_initialize(args = {})
31
31
  end
32
32
 
33
33
  private
@@ -52,7 +52,6 @@ module Dradis
52
52
  raise "You need to pass a :plugin value to your Exporter or define it under your plugin's root namespace."
53
53
  end
54
54
  end
55
-
56
55
  end # Base
57
56
  end # Export
58
57
  end # Plugins
@@ -7,7 +7,7 @@ module Dradis
7
7
 
8
8
  module VERSION
9
9
  MAJOR = 4
10
- MINOR = 18
10
+ MINOR = 19
11
11
  TINY = 0
12
12
  PRE = nil
13
13
 
@@ -2,15 +2,13 @@ module Dradis
2
2
  module Plugins
3
3
  module Import
4
4
  module Filters
5
-
6
5
  class Base
7
- def self.query(args={})
6
+ def self.query(args = {})
8
7
  instance = self.new
9
8
  instance.query(args)
10
9
  end
11
10
  end
12
-
13
11
  end
14
12
  end
15
13
  end
16
- end
14
+ end
@@ -1,7 +1,6 @@
1
1
  module Dradis
2
2
  module Plugins
3
3
  module Import
4
-
5
4
  module Filters
6
5
  class << self
7
6
  # -- Class Methods --------------------------------------------------------
@@ -45,7 +44,6 @@ module Dradis
45
44
  end
46
45
  end
47
46
  end
48
-
49
47
  end
50
48
  end
51
- end
49
+ end
@@ -1,12 +1,13 @@
1
1
  module Dradis::Plugins::Import
2
2
  class Result
3
- attr_accessor :description, :id, :tags, :title
3
+ attr_accessor :description, :id, :tags, :title, :state
4
4
 
5
- def initialize(args={})
5
+ def initialize(args = {})
6
6
  @description = args[:description] || "The Import plugin didn't provide a :description for this result."
7
7
  @id = args[:id] || "The Import plugin didn't provide an :id for this result."
8
8
  @tags = args[:tags] || []
9
9
  @title = args[:title] || "The Import plugin didn't provide a :title for this result."
10
+ @state = args[:state] || nil
10
11
  end
11
12
  end
12
13
  end
@@ -8,7 +8,6 @@ module Dradis::Plugins::Mappings::Base
8
8
  end
9
9
 
10
10
  module ClassMethods
11
-
12
11
  def default_mapping_fields(source)
13
12
  default_mapping(source).map do |destination_field, content|
14
13
  MappingField.new(destination_field: destination_field, content: content)
@@ -20,7 +20,7 @@ module Dradis::Plugins
20
20
  value: value = dirty_or_stored_or_default(key.to_sym),
21
21
  default: is_default?(key, value)
22
22
  }
23
- end.sort_by{ |o| o[:name] }
23
+ end.sort_by { |o| o[:name] }
24
24
  end
25
25
 
26
26
  def save
@@ -32,7 +32,7 @@ module Dradis::Plugins
32
32
  end
33
33
 
34
34
  def update_settings(opts = {})
35
- opts.select{ |k, v| @default_options.key?(k) }.each do |k, v|
35
+ opts.select { |k, v| @default_options.key?(k) }.each do |k, v|
36
36
  @dirty_options[k.to_sym] = v
37
37
  end
38
38
  save
@@ -17,9 +17,9 @@ module Dradis
17
17
  end
18
18
  end
19
19
 
20
- def plugin_thorfiles(args={})
20
+ def plugin_thorfiles(args = {})
21
21
  if paths['dradis/thorfiles'].existent.any?
22
- Dir["%s/thorfile.rb" % paths['dradis/thorfiles'].existent]
22
+ Dir['%s/thorfile.rb' % paths['dradis/thorfiles'].existent]
23
23
  else
24
24
  []
25
25
  end
@@ -27,4 +27,4 @@ module Dradis
27
27
  end
28
28
  end
29
29
  end
30
- end
30
+ end
@@ -16,7 +16,6 @@ module Dradis
16
16
  @logger ||= default_logger
17
17
  end
18
18
 
19
-
20
19
  private
21
20
  def default_logger
22
21
  STDOUT.sync = true
@@ -5,11 +5,10 @@
5
5
  module Dradis
6
6
  module Plugins
7
7
  module Upload
8
-
9
8
  class FieldProcessor
10
9
  attr_reader :data
11
10
 
12
- def initialize(args={})
11
+ def initialize(args = {})
13
12
  @data = args[:data]
14
13
  post_initialize(args)
15
14
  end
@@ -18,18 +17,17 @@ module Dradis
18
17
  # and extract the value of the requested field.
19
18
  #
20
19
  # Subclasses will overwrite this method.
21
- def value(args={})
20
+ def value(args = {})
22
21
  field = args[:field]
23
22
  "Sorry, this plugin doesn't define a FieldProcessor (called for [#{field}])"
24
23
  end
25
24
 
26
25
  protected
27
26
  # This can be overriden by subclasses
28
- def post_initialize(args={})
27
+ def post_initialize(args = {})
29
28
  # nop
30
29
  end
31
30
  end
32
-
33
31
  end
34
32
  end
35
33
  end
@@ -20,7 +20,7 @@ module Dradis
20
20
  { evidence: 'evidence', issue: 'issue' }
21
21
  end
22
22
 
23
- def initialize(args={})
23
+ def initialize(args = {})
24
24
  @options = args
25
25
 
26
26
  @default_user_id = args[:default_user_id] || -1
@@ -35,12 +35,12 @@ module Dradis
35
35
  post_initialize(args)
36
36
  end
37
37
 
38
- def import(args={})
38
+ def import(args = {})
39
39
  raise "The import() method is not implemented in this plugin [#{self.class.name}]."
40
40
  end
41
41
 
42
42
  # This method can be overwriten by plugins to do initialization tasks.
43
- def post_initialize(args={})
43
+ def post_initialize(args = {})
44
44
  end
45
45
 
46
46
  private
@@ -81,7 +81,6 @@ module Dradis
81
81
  )
82
82
  end
83
83
  end # Importer
84
-
85
84
  end # Upload
86
85
  end # Plugins
87
86
  end # Core
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  require 'dradis/plugins/upload/base'
9
9
  require 'dradis/plugins/upload/importer'
10
- require 'dradis/plugins/upload/field_processor'
10
+ require 'dradis/plugins/upload/field_processor'
@@ -8,4 +8,4 @@ module Dradis
8
8
  gem_version
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -78,7 +78,6 @@ module Dradis
78
78
  end
79
79
  end
80
80
 
81
-
82
81
  require 'dradis/plugins/engine'
83
82
  require 'dradis/plugins/version'
84
83
 
@@ -18,19 +18,19 @@ describe Dradis::Plugins::Settings do
18
18
  TestEngine::settings.reset_defaults!
19
19
  end
20
20
 
21
- it "sets and return default values" do
21
+ it 'sets and return default values' do
22
22
  expect(TestEngine::settings.host).to eq('localhost')
23
23
  expect(TestEngine::settings.port).to eq(80)
24
24
  end
25
25
 
26
- it "sets and returns user defined values" do
26
+ it 'sets and returns user defined values' do
27
27
  expect(TestEngine::settings.host).to eq('localhost')
28
28
  TestEngine::settings.host = '127.0.0.1'
29
29
  expect(TestEngine::settings.host).to eq('127.0.0.1')
30
30
  expect(TestEngine::settings.port).to eq(80)
31
31
  end
32
32
 
33
- it "sets and returns new value even if it equals default value" do
33
+ it 'sets and returns new value even if it equals default value' do
34
34
  expect(TestEngine::settings.host).to eq('localhost')
35
35
  TestEngine::settings.host = '127.0.0.1'
36
36
  expect(TestEngine::settings.host).to eq('127.0.0.1')
@@ -38,17 +38,17 @@ describe Dradis::Plugins::Settings do
38
38
  expect(TestEngine::settings.host).to eq('localhost')
39
39
  end
40
40
 
41
- it "saves to db and returns persisted values" do
41
+ it 'saves to db and returns persisted values' do
42
42
  expect(TestEngine::settings.host).to eq('localhost')
43
43
  TestEngine::settings.host = '127.0.0.1'
44
- expect(TestEngine::settings.save).to eq( { host: '127.0.0.1'} )
44
+ expect(TestEngine::settings.save).to eq({ host: '127.0.0.1' })
45
45
  expect(TestEngine::settings.host).to eq('127.0.0.1')
46
46
  end
47
47
 
48
- it "reads from db after saving" do
48
+ it 'reads from db after saving' do
49
49
  expect(TestEngine::settings.host).to eq('localhost')
50
50
  TestEngine::settings.host = '127.0.0.1'
51
- expect(TestEngine::settings.save).to eq( { host: '127.0.0.1'} )
51
+ expect(TestEngine::settings.save).to eq({ host: '127.0.0.1' })
52
52
  end
53
53
 
54
54
  end
@@ -83,5 +83,3 @@ describe Dradis::Plugins::Settings, '#all' do
83
83
  ])
84
84
  end
85
85
  end
86
-
87
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.0
4
+ version: 4.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
@@ -51,6 +51,20 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rubocop
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 1.79.0
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '='
66
+ - !ruby/object:Gem::Version
67
+ version: 1.79.0
54
68
  description: Required dependency for Dradis Framework.
55
69
  executables: []
56
70
  extensions: []
@@ -59,6 +73,7 @@ files:
59
73
  - ".github/pull_request_template.md"
60
74
  - ".gitignore"
61
75
  - ".rspec"
76
+ - ".rubocop.yml"
62
77
  - CHANGELOG.md
63
78
  - CHANGELOG.template
64
79
  - CONTRIBUTING.md