8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/stratagem/scan/checks/capistrano/secure_deploy.rb', line 8
def run
begin
gem 'capistrano'
require 'capistrano/configuration'
begin
config = Capistrano::Configuration.new
config.load "config/deploy"
vars = config.variables
repository_url = vars[:repository]
if (repository_url)
uri = URI::parse(repository_url)
unless (SECURE_PROTOCOLS.include?(uri.scheme.downcase))
result(
:concern_type => :best_practice,
:unique => 'repository_url',
:component => nil,
:payload => repository_url)
end
else
puts "Unable to locate Capistrano repository in deploy script"
end
rescue ArgumentError
puts "Capistrano deploy script could not be loaded. - #{$!.message}"
rescue LoadError
puts "Capistrano deploy script not found. - #{$!.message}"
puts $!.class.name
end
rescue Gem::LoadError
puts "ERROR: Unable to load Capistrano"
end
end
|