aws_security_viz 0.2.1.pre.alpha.pre.269 → 0.2.1.pre.alpha.pre.278
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/spec/integration/visualize_aws_spec.rb +24 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 035cd6c263db0a456f221d6f46790cdb6eae3dbdfcd17d5bf5ae776eb6e4fe0a
|
4
|
+
data.tar.gz: 2214846679c445cde0005086acd776f17d836c5d1b6970de951cfcc79d79e6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04204b3106c983c0bfb103fd437441e7b015ef00890e8c3088ffab1ca84e95ba4e0a23d7eb78c5187ae8a41aaa96eae5f900b025e31c9cc7afe989c61365bea4
|
7
|
+
data.tar.gz: cd8fef57bdae83be03b0320939376abbdcbafba60ca6cd6c34eb27382e7aa15fd25a1ad3c935afbead7209fcbd4dab9515f1c8b5efc37021ff93da9c895e476d
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'tempfile'
|
3
3
|
|
4
|
+
RSpec::Matchers.define :be_graph_with do |nodes|
|
5
|
+
match do |graphv|
|
6
|
+
graphv.nodes.keys == nodes
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
4
10
|
describe VisualizeAws do
|
5
11
|
let(:opts) {
|
6
12
|
{
|
@@ -21,24 +27,38 @@ describe VisualizeAws do
|
|
21
27
|
VisualizeAws.new(config, opts).unleash(temp_file.path)
|
22
28
|
expect(expected_content).to eq(actual_content)
|
23
29
|
end
|
30
|
+
|
31
|
+
it 'should parse json input with stubbed out graphviz' do
|
32
|
+
nodes = ["app", "8.8.8.8/32", "amazon-elb-sg", "*", "db"]
|
33
|
+
allow(Graphviz).to receive(:output).with(be_graph_with(nodes), path: temp_file.path, format: nil)
|
34
|
+
VisualizeAws.new(config, opts).unleash(temp_file.path)
|
35
|
+
end
|
24
36
|
end
|
25
37
|
|
26
38
|
context 'json to json file' do
|
27
39
|
let(:expected_file) { File.join(File.dirname(__FILE__), 'expected.json') }
|
28
40
|
let(:temp_file) { Tempfile.new(%w(aws .json)) }
|
29
41
|
|
30
|
-
it 'should parse json input'
|
42
|
+
it 'should parse json input' do
|
31
43
|
expect(FileUtils).to receive(:copy)
|
32
44
|
VisualizeAws.new(config, opts.merge(:renderer => 'json')).unleash(temp_file.path)
|
33
45
|
expect(JSON.parse(expected_content)).to eq(JSON.parse(actual_content))
|
34
46
|
end
|
47
|
+
|
48
|
+
it 'should parse json input with obfuscation' do
|
49
|
+
config = AwsConfig.new({groups: {'0.0.0.0/0' => '*'}, obfuscate: true})
|
50
|
+
expect(FileUtils).to receive(:copy)
|
51
|
+
VisualizeAws.new(config, opts.merge(:renderer => 'json')).unleash(temp_file.path)
|
52
|
+
expect(actual_content).not_to include('"amazon-elb-sg"', '"app"', '"db"')
|
53
|
+
end
|
54
|
+
|
35
55
|
end
|
36
56
|
|
37
57
|
context 'json to navigator file' do
|
38
58
|
let(:expected_file) { File.join(File.dirname(__FILE__), 'navigator.json') }
|
39
59
|
let(:temp_file) { Tempfile.new(%w(aws .json)) }
|
40
60
|
|
41
|
-
it 'should parse json input'
|
61
|
+
it 'should parse json input' do
|
42
62
|
expect(FileUtils).to receive(:copy)
|
43
63
|
VisualizeAws.new(config, opts.merge(:renderer => 'navigator')).unleash(temp_file.path)
|
44
64
|
expect(JSON.parse(expected_content)).to eq(JSON.parse(actual_content))
|
@@ -53,7 +73,8 @@ describe VisualizeAws do
|
|
53
73
|
{
|
54
74
|
:filename => temp_file,
|
55
75
|
:secret_key => ENV['TEST_SECRET_KEY'],
|
56
|
-
:access_key => ENV['TEST_ACCESS_KEY']
|
76
|
+
:access_key => ENV['TEST_ACCESS_KEY'],
|
77
|
+
:region => 'us-east-1'
|
57
78
|
}
|
58
79
|
}
|
59
80
|
|