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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42589763944aa2efaaf22a7a87106ceca1e36076f1ba99aa23d3860cf336b45e
4
- data.tar.gz: 89cf97f11e19d7cc63e4d3d4085056beb7264518d6b56d3d7df829907fe6f412
3
+ metadata.gz: 035cd6c263db0a456f221d6f46790cdb6eae3dbdfcd17d5bf5ae776eb6e4fe0a
4
+ data.tar.gz: 2214846679c445cde0005086acd776f17d836c5d1b6970de951cfcc79d79e6d9
5
5
  SHA512:
6
- metadata.gz: 980a68f9c4da1ea1a00a4ac29114848d32eb10778de8f93c3d5d193c76562d2d73ab4d8aa4a566da4218aef5abf51e72277c7eae8b811eba3db47fa338a3d36a
7
- data.tar.gz: ee734c1d4883fa045823e6707e9f59306347962004a96e3f14b6205234025814b6f50d9c9e4328a49e2972a22f5a7eea8b91d8dfb384107afdff8b513a0fbe8b
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', :integration => true do
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', :integration => true do
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_security_viz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre.alpha.pre.269
4
+ version: 0.2.1.pre.alpha.pre.278
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anay Nayak