Class: Rails::Guarddog::Configuration
- Inherits:
-
Object
- Object
- Rails::Guarddog::Configuration
- Defined in:
- lib/rails/guarddog/configuration.rb
Instance Attribute Summary collapse
-
#disabled_checkers ⇒ Object
Returns the value of attribute disabled_checkers.
-
#enabled_checkers ⇒ Object
Returns the value of attribute enabled_checkers.
-
#excluded_paths ⇒ Object
Returns the value of attribute excluded_paths.
-
#ignored_checks ⇒ Object
Returns the value of attribute ignored_checks.
-
#output_format ⇒ Object
Returns the value of attribute output_format.
- #root ⇒ Object
Instance Method Summary collapse
-
#active_checkers ⇒ Object
The final resolved list of checkers to run: enabled_checkers minus anything in disabled_checkers.
- #all_checkers ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rails/guarddog/configuration.rb', line 7 def initialize @root = nil @enabled_checkers = all_checkers # Checkers to turn off without having to list every other checker in # enabled_checkers. Takes priority over enabled_checkers. # Example: disable just dos and rate_limit: # config.disabled_checkers = %w[dos rate_limit] @disabled_checkers = [] @excluded_paths = %w[vendor node_modules] # Per-directory checker suppression: keys are path substrings, values are # arrays of checker names (same format as enabled_checkers). # Defaults suppress the `secrets` checker inside spec/test trees because # dummy passwords in test fixtures are intentional and not a real risk. @ignored_checks = { "spec" => %w[secrets], "test" => %w[secrets] } @output_format = :console end |
Instance Attribute Details
#disabled_checkers ⇒ Object
Returns the value of attribute disabled_checkers.
5 6 7 |
# File 'lib/rails/guarddog/configuration.rb', line 5 def disabled_checkers @disabled_checkers end |
#enabled_checkers ⇒ Object
Returns the value of attribute enabled_checkers.
5 6 7 |
# File 'lib/rails/guarddog/configuration.rb', line 5 def enabled_checkers @enabled_checkers end |
#excluded_paths ⇒ Object
Returns the value of attribute excluded_paths.
5 6 7 |
# File 'lib/rails/guarddog/configuration.rb', line 5 def excluded_paths @excluded_paths end |
#ignored_checks ⇒ Object
Returns the value of attribute ignored_checks.
5 6 7 |
# File 'lib/rails/guarddog/configuration.rb', line 5 def ignored_checks @ignored_checks end |
#output_format ⇒ Object
Returns the value of attribute output_format.
5 6 7 |
# File 'lib/rails/guarddog/configuration.rb', line 5 def output_format @output_format end |
Instance Method Details
#active_checkers ⇒ Object
The final resolved list of checkers to run: enabled_checkers minus anything in disabled_checkers.
29 30 31 |
# File 'lib/rails/guarddog/configuration.rb', line 29 def active_checkers enabled_checkers - Array(@disabled_checkers).map(&:to_s) end |
#all_checkers ⇒ Object
37 38 39 40 41 42 |
# File 'lib/rails/guarddog/configuration.rb', line 37 def all_checkers %w[ sql_injection xss csrf mass_assignment open_redirect secrets dos idor ai_injection rate_limit dependency graphql ] end |