Class: RogIQ::Commands::Security

Inherits:
Base
  • Object
show all
Defined in:
lib/rogiq/commands/security.rb

Instance Method Summary collapse

Instance Method Details

#auditObject



19
20
21
22
23
# File 'lib/rogiq/commands/security.rb', line 19

def audit
  api = RogIQ.api_root
  ok = system("bundle", "exec", "bundle-audit", "check", chdir: api)
  exit(ok ? 0 : 1)
end

#policyObject



26
27
28
29
30
# File 'lib/rogiq/commands/security.rb', line 26

def policy
  RogIQ.load_rails!
  Rails.application.load_tasks
  Rake::Task["security_policy:diagnose"].invoke
end

#scanObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/rogiq/commands/security.rb', line 7

def scan
  api = RogIQ.api_root
  brakeman = File.join(api, "bin", "brakeman")
  cmd = File.exist?(brakeman) ? [ brakeman.to_s, "-q" ] : %w[bundle exec brakeman -q]
  ok = system(*cmd, chdir: api)
  unless ok
    fmt.error_msg("Brakeman failed or gem not available in this bundle group.")
    exit 1
  end
end