controls 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +9 -0
  5. data/README.md +2 -0
  6. data/Rakefile +6 -1
  7. data/apiary.apib +60 -0
  8. data/controls.gemspec +0 -3
  9. data/lib/controls/client.rb +11 -4
  10. data/lib/controls/client/events.rb +21 -0
  11. data/lib/controls/client/guidance.rb +0 -4
  12. data/lib/controls/client/security_controls.rb +0 -4
  13. data/lib/controls/client/threats.rb +0 -4
  14. data/lib/controls/default.rb +2 -1
  15. data/lib/controls/ext/dish/plate.rb +8 -10
  16. data/lib/controls/objects.rb +4 -0
  17. data/lib/controls/objects/coverage_information.rb +0 -1
  18. data/lib/controls/objects/event.rb +18 -0
  19. data/lib/controls/objects/product_change_event_payload.rb +4 -0
  20. data/lib/controls/objects/security_control_change_event_payload.rb +4 -0
  21. data/lib/controls/objects/site_change_event_payload.rb +4 -0
  22. data/lib/controls/version.rb +1 -1
  23. data/spec/controls/client/assessments_spec.rb +24 -0
  24. data/spec/controls/client/events_spec.rb +54 -0
  25. data/spec/matchers.rb +46 -0
  26. data/spec/spec_helper.rb +14 -0
  27. metadata +17 -71
  28. data/docs/Gemfile +0 -10
  29. data/docs/Rules +0 -31
  30. data/docs/content/index.md +0 -8
  31. data/docs/content/v1.md +0 -8
  32. data/docs/content/v1/authentication.md +0 -3
  33. data/docs/content/v1/search.md +0 -11
  34. data/docs/content/v1/troubleshooting.md +0 -3
  35. data/docs/layouts/default.html +0 -46
  36. data/docs/layouts/home.html +0 -51
  37. data/docs/lib/default.rb +0 -2
  38. data/docs/nanoc.yaml +0 -43
  39. data/docs/static/css/bootstrap-theme.css +0 -397
  40. data/docs/static/css/bootstrap-theme.min.css +0 -7
  41. data/docs/static/css/bootstrap.css +0 -7118
  42. data/docs/static/css/bootstrap.min.css +0 -7
  43. data/docs/static/fonts/glyphicons-halflings-regular.eot +0 -0
  44. data/docs/static/fonts/glyphicons-halflings-regular.svg +0 -229
  45. data/docs/static/fonts/glyphicons-halflings-regular.ttf +0 -0
  46. data/docs/static/fonts/glyphicons-halflings-regular.woff +0 -0
  47. data/docs/static/images/controlsinsight-shield.png +0 -0
  48. data/docs/static/images/controlsinsight.png +0 -0
  49. data/docs/static/js/bootstrap.js +0 -2006
  50. data/docs/static/js/bootstrap.min.js +0 -7
  51. data/spec/controls_spec.rb +0 -22
  52. data/spec/helper.rb +0 -42
data/spec/matchers.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'rspec/expectations'
2
+
3
+ # Assessment Matchers
4
+ RSpec::Matchers.define :match_assessment_format do
5
+ match do |resource|
6
+ # Reverses the coercion
7
+ resource.timestamp = resource.timestamp.to_i
8
+ [
9
+ resource.high_risk_asset_count,
10
+ resource.id,
11
+ resource.low_risk_asset_count,
12
+ resource.medium_risk_asset_count,
13
+ resource.timestamp,
14
+ resource.total_asset_count
15
+ ].each do |attribute|
16
+ expect(attribute.class).to eq(Fixnum)
17
+ end
18
+
19
+ expect(resource.assessing.class).to include([TrueClass, FalseClass])
20
+ expect(resource.overall_risk_score.class).to include([Float])
21
+ end
22
+ end
23
+
24
+ #RSpec::Matchers.define :match_event_format do
25
+ # [Fixnum].include? resource.createdAt
26
+ # [Hash].include? resource.payload
27
+ # [String].include? resource.type
28
+ # [String].include? resource.user
29
+ #end
30
+ #
31
+ #RSpec::Matchers.define :match_site_change_event_payload_format do
32
+ # [TrueClass,FalseClass].include? resource.impactsGrade.class
33
+ # [String].include? resource.notes.class
34
+ # [String].include? resource.productVersion.class
35
+ #end
36
+ #
37
+ #RSpec::Matchers.define :match_security_control_change_event_payload_format do
38
+ # [String,NilClass].include?resource.reason
39
+ # [String]}]].include?resource.changes:[Array,[Hash,{securityControlName:[String],action
40
+ #end
41
+ #
42
+ #RSpec::Matchers.define :match__change_event_payload_format do
43
+ # [String,NilClass].include?resource.reason
44
+ # [Fixnum]}]].include?resource.enabledSites:[Array,[Hash,{name:[String],id
45
+ # [TrueClass.include?resource.importAllFalseClass]
46
+ #end
@@ -0,0 +1,14 @@
1
+ require 'controls'
2
+ require_relative './matchers.rb'
3
+
4
+ module SpecHelpers
5
+ def login_to_environment
6
+ # Allow self-signed certs in continuous integration
7
+ Controls.verify_ssl = false
8
+ Controls.login(ENV['CONTROLS_USERNAME'], ENV['CONTROLS_PASSWORD'])
9
+ end
10
+ end
11
+
12
+ RSpec.configure do |rspec|
13
+ rspec.include SpecHelpers
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: controls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erran Carey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dish
@@ -80,48 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: vcr
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: yard
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
83
  description: This gem interfaces to Rapid7's **controls**insight API.
126
84
  email:
127
85
  - "'me@errancarey.com'"
@@ -131,35 +89,14 @@ extra_rdoc_files: []
131
89
  files:
132
90
  - ".gitignore"
133
91
  - ".ruby-version"
92
+ - ".travis.yml"
134
93
  - ".yardopts"
135
94
  - Gemfile
136
95
  - LICENSE.md
137
96
  - README.md
138
97
  - Rakefile
98
+ - apiary.apib
139
99
  - controls.gemspec
140
- - docs/Gemfile
141
- - docs/Rules
142
- - docs/content/index.md
143
- - docs/content/v1.md
144
- - docs/content/v1/authentication.md
145
- - docs/content/v1/search.md
146
- - docs/content/v1/troubleshooting.md
147
- - docs/layouts/default.html
148
- - docs/layouts/home.html
149
- - docs/lib/default.rb
150
- - docs/nanoc.yaml
151
- - docs/static/css/bootstrap-theme.css
152
- - docs/static/css/bootstrap-theme.min.css
153
- - docs/static/css/bootstrap.css
154
- - docs/static/css/bootstrap.min.css
155
- - docs/static/fonts/glyphicons-halflings-regular.eot
156
- - docs/static/fonts/glyphicons-halflings-regular.svg
157
- - docs/static/fonts/glyphicons-halflings-regular.ttf
158
- - docs/static/fonts/glyphicons-halflings-regular.woff
159
- - docs/static/images/controlsinsight-shield.png
160
- - docs/static/images/controlsinsight.png
161
- - docs/static/js/bootstrap.js
162
- - docs/static/js/bootstrap.min.js
163
100
  - lib/controls.rb
164
101
  - lib/controls/authentication.rb
165
102
  - lib/controls/client.rb
@@ -167,6 +104,7 @@ files:
167
104
  - lib/controls/client/assets.rb
168
105
  - lib/controls/client/configurations.rb
169
106
  - lib/controls/client/coverage.rb
107
+ - lib/controls/client/events.rb
170
108
  - lib/controls/client/guidance.rb
171
109
  - lib/controls/client/prioritized_guidance.rb
172
110
  - lib/controls/client/security_controls.rb
@@ -182,17 +120,23 @@ files:
182
120
  - lib/controls/objects/configuration.rb
183
121
  - lib/controls/objects/configuration_finding.rb
184
122
  - lib/controls/objects/coverage_information.rb
123
+ - lib/controls/objects/event.rb
185
124
  - lib/controls/objects/guidance.rb
125
+ - lib/controls/objects/product_change_event_payload.rb
186
126
  - lib/controls/objects/security_control.rb
127
+ - lib/controls/objects/security_control_change_event_payload.rb
187
128
  - lib/controls/objects/security_control_coverage.rb
188
129
  - lib/controls/objects/security_control_finding.rb
130
+ - lib/controls/objects/site_change_event_payload.rb
189
131
  - lib/controls/objects/threat.rb
190
132
  - lib/controls/objects/threat_vector.rb
191
133
  - lib/controls/objects/trend.rb
192
134
  - lib/controls/response.rb
193
135
  - lib/controls/version.rb
194
- - spec/controls_spec.rb
195
- - spec/helper.rb
136
+ - spec/controls/client/assessments_spec.rb
137
+ - spec/controls/client/events_spec.rb
138
+ - spec/matchers.rb
139
+ - spec/spec_helper.rb
196
140
  homepage: ''
197
141
  licenses:
198
142
  - MIT
@@ -218,6 +162,8 @@ signing_key:
218
162
  specification_version: 4
219
163
  summary: This gem interfaces to Rapid7's **controls**insight API.
220
164
  test_files:
221
- - spec/controls_spec.rb
222
- - spec/helper.rb
165
+ - spec/controls/client/assessments_spec.rb
166
+ - spec/controls/client/events_spec.rb
167
+ - spec/matchers.rb
168
+ - spec/spec_helper.rb
223
169
  has_rdoc:
data/docs/Gemfile DELETED
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'maruku'
4
- gem 'nanoc'
5
- gem 'pygments.rb'
6
-
7
- group :development do
8
- gem 'adsf'
9
- end
10
- gem 'nokogiri'
data/docs/Rules DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- compile '/static/*' do
4
- end
5
-
6
- compile '/stylesheet/' do
7
- end
8
-
9
- compile '*' do
10
- unless item.binary?
11
- filter :erb
12
- filter :maruku
13
- filter :colorize_syntax,
14
- :colorizers => { :ruby => :pygmentsrb, :json => :pygmentsrb }
15
- layout item[:layout] || 'default'
16
- end
17
- end
18
-
19
- route '/static/*' do
20
- item.identifier[7..-2]
21
- end
22
-
23
- route '*' do
24
- if item.binary?
25
- item.identifier.chop + '.' + item[:extension]
26
- else
27
- item.identifier + 'index.html'
28
- end
29
- end
30
-
31
- layout '*', :erb
@@ -1,8 +0,0 @@
1
- ---
2
- title: Overview
3
- layout: home
4
- ---
5
- ## Using the ControlsInsight API {: #using-the-controlsinsight-api}
6
- Jump right in and use the ControlsInsight API.
7
-
8
- [Browse the documentation](v1/){: .btn .btn-primary}
data/docs/content/v1.md DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- title: ControlsInsight API v1
3
- ---
4
- ## Overview
5
- The ControlsInsight API v1 is described here. If you have any questions
6
- or requests please [contact Rapid7 support][support].
7
-
8
- [support]: http://www.rapid7.com/contact/ "Rapid7 Support"
@@ -1,3 +0,0 @@
1
- ---
2
- title: Authentication
3
- ---
@@ -1,11 +0,0 @@
1
- ---
2
- title: Search
3
- ---
4
- ## Asset Search {: #asset-search}
5
- Find assets by multiple criteria including, but not limited to the
6
- asset's:
7
- - name
8
- - hostname
9
- - IP address
10
-
11
- <pre><code>GET /assets/search?query={query}{&amp;page,per_page,sort}</code></pre>
@@ -1,3 +0,0 @@
1
- ---
2
- title: Troubleshooting
3
- ---
@@ -1,46 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <base href="http://rapid7.github.io/controlsinsight.rb/">
7
- <title><%= @item[:title] %> | ControlsInsight API</title>
8
- <link rel="stylesheet" href="css/bootstrap.css">
9
-
10
- <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
11
- </head>
12
- <body>
13
- <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
14
- <a href="#" class="navbar-brand">ControlsInsight</a>
15
- <ul class="nav navbar-nav pull-right">
16
- <li><a href="#">Overview</a></li>
17
- <li><a href="v1/">API</a></li>
18
- <li><a href="https://community.rapid7.com/community/controls-insight/blog">Blog</a></li>
19
- <li><a href="http://www.rapid7.com/contact/">Support</a></li>
20
- </ul>
21
- </nav>
22
-
23
- <div class="container">
24
- <div class="page-header">
25
- <h1><%= @item[:title] %></h1>
26
- </div>
27
-
28
- <div class="row">
29
- <div class="col-xs-8"><%= yield %></div>
30
-
31
- <div class="col-xs-2"></div>
32
- <div class="col-xs-2">
33
- <ul class="nav nav-pills nav-stacked">
34
- <!-- Overview items -->
35
- <li><h4><a href="v1/">Overview</a></h4></li>
36
- <li><a href="v1/authentication/">Authentication</a></li>
37
- <li><a href="v1/troubleshooting/">Troubleshooting</a></li>
38
- <!-- Search items -->
39
- <li><h4><a href="v1/search/">Search</a></h4></li>
40
- <li><a href="v1/search/#asset-search">Asset Search</a></li>
41
- </ul>
42
- </div>
43
- </div>
44
- </div>
45
- </body>
46
- </html>
@@ -1,51 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <base href="http://rapid7.github.io/controlsinsight.rb/">
7
- <title><%= @item[:title] %></title>
8
- <link rel="stylesheet" href="css/bootstrap.css">
9
-
10
- <!-- you don't need to keep this, but it's cool for stats! -->
11
- <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
12
- </head>
13
- <body>
14
- <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
15
- <a href="#" class="navbar-brand">ControlsInsight</a>
16
- <ul class="nav navbar-nav pull-right">
17
- <li><a href="#">Overview</a></li>
18
- <li><a href="v1/">API</a></li>
19
- <li><a href="https://community.rapid7.com/community/controls-insight/blog">Blog</a></li>
20
- <li><a href="http://www.rapid7.com/contact/">Support</a></li>
21
- </ul>
22
- </nav>
23
-
24
- <div class="container">
25
- <div class="page-header"><h1><%= @item[:title] %></h1></div>
26
- <%= yield %>
27
- </div>
28
-
29
- <div class="row well">
30
- <div class="container">
31
- <div class="col-lg-4">
32
- <h1 class="text-center"><span class="glyphicon glyphicon-book"></span></h1>
33
- <p class="text-center lead"><a href="guides/">API Usage</a></h2>
34
- <p class="text-center">Just getting started? Make sure to read the guides.</p>
35
- </div>
36
-
37
- <div class="col-lg-4">
38
- <h1 class="text-center"><span class="glyphicon glyphicon-list"></span></h1>
39
- <p class="text-center lead"><a href="libraries/">Client Libraries</a></h2>
40
- <p class="text-center">Check out some client libraries written for the ControlsInsight API.</p>
41
- </div>
42
-
43
- <div class="col-lg-4">
44
- <h1 class="text-center"><span class="glyphicon glyphicon-info-sign"></span></h1>
45
- <p class="text-center lead"><a href="http://www.rapid7.com/contact/">Support</a></h2>
46
- <p class="text-center">If the <a href="v1/troubleshooting/">troubleshooting/FAQs</a> didn't help you please contact Rapid7 Support.</p>
47
- </div>
48
- </div>
49
- </div>
50
- </body>
51
- </html>
data/docs/lib/default.rb DELETED
@@ -1,2 +0,0 @@
1
- # All files in the 'lib' directory will be loaded
2
- # before nanoc starts compiling.
data/docs/nanoc.yaml DELETED
@@ -1,43 +0,0 @@
1
- output_dir: output
2
- index_filenames:
3
- - index.html
4
- enable_output_diff: false
5
- data_sources:
6
- -
7
- type: filesystem_unified
8
- items_root: /
9
- layouts_root: /
10
- allow_periods_in_identifiers: false
11
- -
12
- type: static
13
- items_root: /static
14
- allow_periods_in_identifiers: true
15
- prune:
16
- auto_prune: false
17
- exclude:
18
- - .git
19
- - .hg
20
- - .svn
21
- - CVS
22
- text_extensions:
23
- - coffee
24
- - css
25
- - erb
26
- - haml
27
- - handlebars
28
- - hb
29
- - htm
30
- - html
31
- - js
32
- - less
33
- - markdown
34
- - md
35
- - ms
36
- - mustache
37
- - php
38
- - rb
39
- - sass
40
- - scss
41
- - txt
42
- - xhtml
43
- - xml