Class: Scanny::Checks::SetRailsEnvCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/scanny/checks/insecure_config/set_rails_env_check.rb

Overview

Checks for places where ENV is set.

Instance Method Summary collapse

Methods inherited from Check

#compiled_pattern, #issue, #strict?, #visit

Instance Method Details

#check(node) ⇒ Object



17
18
19
20
21
# File 'lib/scanny/checks/insecure_config/set_rails_env_check.rb', line 17

def check(node)
  issue :info,
    "Setting ENV[\"RAILS_ENV\"] can indicate insecure configuration.",
    :cwe => 209
end

#patternObject

ENV = “test”



6
7
8
9
10
11
12
13
14
15
# File 'lib/scanny/checks/insecure_config/set_rails_env_check.rb', line 6

def pattern
  <<-EOT
    ElementAssignment<
      receiver  = ConstantAccess<name = :ENV>,
      arguments = ActualArguments<
        array = [StringLiteral<string = "RAILS_ENV">, any]
      >
    >
  EOT
end