puppet-sec-lint 0.5.11 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/puppet-sec-lint.iml +2 -24
- data/Gemfile +3 -1
- data/Gemfile.lock +4 -1
- data/exe/puppet-sec-lint +9 -0
- data/lib/puppet-sec-lint/version.rb +1 -1
- data/lib/rule_engine.rb +3 -3
- data/lib/servers/language_server.rb +2 -2
- data/lib/servers/linter_server.rb +3 -1
- data/puppet-sec-lint.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfaad87ab6375c69dd2cb27773653373587f35e3cc74d4cba47c0bb05a69bd18
|
4
|
+
data.tar.gz: 9c5a606fc0867a133d38ab6033f9fe6b66eaae4a8e7426f45d59fea1ff3d4b34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26a4648b94a03331d14bcb1da29938809c5869b8f013c9f4510bfdd3dbf8557139ff66a5cb8834066cdd103ade3631001f4a7ebbc9d09b1292c4a7ec4413d96f
|
7
|
+
data.tar.gz: ce98ccc1b55c37bc67d3ba4bafdd68fee493af13cffcab88af893ce276a0b5ba860d4b0a3deb2dc9210e467e24d8f61f14395b9bab2db314c1354df8a8711351
|
data/.idea/puppet-sec-lint.iml
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.3, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="inifile (v3.0.0, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="launchy (v2.5.0, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="logger (v1.4.3, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
18
19
|
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.14.4, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
19
20
|
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.6, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
20
21
|
<orderEntry type="library" scope="PROVIDED" name="puppet-lint (v2.4.2, RVM: ruby-3.0.0 [global]) [gem]" level="application" />
|
@@ -24,30 +25,7 @@
|
|
24
25
|
</component>
|
25
26
|
<component name="RakeTasksCache">
|
26
27
|
<option name="myRootTask">
|
27
|
-
<RakeTaskImpl id="rake"
|
28
|
-
<subtasks>
|
29
|
-
<RakeTaskImpl description="Build puppet-sec-lint-0.5.7.gem into the pkg directory" fullCommand="build" id="build" />
|
30
|
-
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
31
|
-
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
32
|
-
<RakeTaskImpl description="Build and install puppet-sec-lint-0.5.7.gem into system gems" fullCommand="install" id="install" />
|
33
|
-
<RakeTaskImpl id="install">
|
34
|
-
<subtasks>
|
35
|
-
<RakeTaskImpl description="Build and install puppet-sec-lint-0.5.7.gem into system gems without network access" fullCommand="install:local" id="local" />
|
36
|
-
</subtasks>
|
37
|
-
</RakeTaskImpl>
|
38
|
-
<RakeTaskImpl description="Create tag v0.5.7 and build and push puppet-sec-lint-0.5.7.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
39
|
-
<RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
|
40
|
-
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
41
|
-
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
42
|
-
<RakeTaskImpl id="release">
|
43
|
-
<subtasks>
|
44
|
-
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
45
|
-
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
46
|
-
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
47
|
-
</subtasks>
|
48
|
-
</RakeTaskImpl>
|
49
|
-
</subtasks>
|
50
|
-
</RakeTaskImpl>
|
28
|
+
<RakeTaskImpl id="rake" />
|
51
29
|
</option>
|
52
30
|
</component>
|
53
31
|
</module>
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puppet-sec-lint (0.5.
|
4
|
+
puppet-sec-lint (0.5.13)
|
5
5
|
inifile (~> 3.0.0)
|
6
6
|
launchy (~> 2.5.0)
|
7
|
+
logger (~> 1.4.3)
|
7
8
|
minitest (~> 5.0)
|
8
9
|
puppet-lint (~> 2.4, >= 2.4.2)
|
9
10
|
rack (~> 2.2.3)
|
@@ -18,6 +19,7 @@ GEM
|
|
18
19
|
inifile (3.0.0)
|
19
20
|
launchy (2.5.0)
|
20
21
|
addressable (~> 2.7)
|
22
|
+
logger (1.4.3)
|
21
23
|
minitest (5.14.4)
|
22
24
|
public_suffix (4.0.6)
|
23
25
|
puppet-lint (2.4.2)
|
@@ -31,6 +33,7 @@ PLATFORMS
|
|
31
33
|
DEPENDENCIES
|
32
34
|
inifile
|
33
35
|
launchy
|
36
|
+
logger
|
34
37
|
minitest (~> 5.0)
|
35
38
|
puppet-lint
|
36
39
|
puppet-sec-lint!
|
data/exe/puppet-sec-lint
CHANGED
@@ -5,6 +5,7 @@ require 'json'
|
|
5
5
|
require 'launchy'
|
6
6
|
require 'optparse'
|
7
7
|
require 'optparse/uri'
|
8
|
+
require 'logger'
|
8
9
|
require_relative '../lib/puppet-sec-lint/version'
|
9
10
|
require_relative '../lib/visitors/configuration_visitor'
|
10
11
|
require_relative '../lib/facades/configuration_file_facade'
|
@@ -12,6 +13,9 @@ require_relative '../lib/facades/configuration_file_facade'
|
|
12
13
|
ConfigurationVisitor.GenerateIDs
|
13
14
|
ConfigurationFileFacade.LoadConfigurations
|
14
15
|
|
16
|
+
$logger = Logger.new(STDOUT)
|
17
|
+
$logger.level = Logger::ERROR
|
18
|
+
|
15
19
|
#get free port
|
16
20
|
loop do
|
17
21
|
$port = rand(3000..9999)
|
@@ -49,6 +53,11 @@ OptionParser.new do |opts|
|
|
49
53
|
opts.on("-p", "--port=PORT", "TCP Port open for socket communication with the language server (Default:5007)") do |port|
|
50
54
|
options[:port] = port
|
51
55
|
end
|
56
|
+
|
57
|
+
opts.on("-v", "--verbose", "Verbose mode (shows all communications and other debug info)") do |v|
|
58
|
+
options[:verbose] = v
|
59
|
+
$logger.level = Logger::DEBUG
|
60
|
+
end
|
52
61
|
end.parse!
|
53
62
|
|
54
63
|
puts '___ _ _ ___ ___ ____ ___ ____ ____ ____ _ _ ____ _ ___ _ _ _ _ _ _ ___ ____ ____ '
|
data/lib/rule_engine.rb
CHANGED
@@ -22,8 +22,8 @@ class RuleEngine
|
|
22
22
|
lexer = PuppetLint::Lexer.new
|
23
23
|
tokens = lexer.tokenise(code)
|
24
24
|
rescue => error
|
25
|
-
|
26
|
-
|
25
|
+
$logger.error("Error in getting tokens from Puppet-Lint")
|
26
|
+
$logger.error(error.backtrace)
|
27
27
|
tokens = []
|
28
28
|
end
|
29
29
|
|
@@ -40,7 +40,7 @@ class RuleEngine
|
|
40
40
|
(result << rule.AnalyzeTokens(tokens)).flatten!
|
41
41
|
end
|
42
42
|
rescue
|
43
|
-
|
43
|
+
$logger.error("Error in running rule #{rule.name}")
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -18,7 +18,7 @@ class LanguageServer
|
|
18
18
|
length=Integer(line.scan(/\d/).join(''))
|
19
19
|
line=client.read(length+2)
|
20
20
|
request = JSON.parse(line)
|
21
|
-
|
21
|
+
$logger.debug(line)
|
22
22
|
|
23
23
|
method_name = request['method'].sub('/', '_')
|
24
24
|
response = if self.respond_to? "client_"+method_name then self.send("client_"+method_name,request['id'],request['params']) end
|
@@ -27,7 +27,7 @@ class LanguageServer
|
|
27
27
|
client.flush
|
28
28
|
client.print("Content-Length: "+response.length.to_s+"\r\n\r\n")
|
29
29
|
client.print(response)
|
30
|
-
|
30
|
+
$logger.debug(response)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
client.close
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rack"
|
2
|
+
require 'webrick'
|
2
3
|
require 'json'
|
3
4
|
require 'uri'
|
4
5
|
require_relative '../rule_engine'
|
@@ -43,7 +44,8 @@ class LinterServer
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def self.start(port)
|
46
|
-
|
47
|
+
log = WEBrick::Log.new $stdout,1
|
48
|
+
Rack::Handler::WEBrick.run(LinterServer.new, :Port => port,Logger: log )
|
47
49
|
end
|
48
50
|
|
49
51
|
end
|
data/puppet-sec-lint.gemspec
CHANGED
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_runtime_dependency 'webrick', '~> 1.7.0'
|
38
38
|
spec.add_runtime_dependency 'inifile', '~> 3.0.0'
|
39
39
|
spec.add_runtime_dependency 'launchy', '~> 2.5.0'
|
40
|
+
spec.add_runtime_dependency 'logger', '~> 1.4.3'
|
40
41
|
|
41
42
|
# For more information and examples about making a new gem, checkout our
|
42
43
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-sec-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Ribeiro
|
@@ -114,6 +114,20 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: 2.5.0
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: logger
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.4.3
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.4.3
|
117
131
|
description: This is a more complete security linter for the puppet language
|
118
132
|
email:
|
119
133
|
- tiago7b27@gmail.com
|