immunio 1.1.10 → 1.1.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c73cecf0da251ae6c4e8fc65c1215a84cca2a9a
4
- data.tar.gz: cc1742b1789f90dce3c6a2ad8a698c7e4e4730da
3
+ metadata.gz: c543f9eeb50f20ef762a41876363e414540aad9e
4
+ data.tar.gz: 3ff0d95fb36d2fbd6c5c8b2937ec1af7ca04059f
5
5
  SHA512:
6
- metadata.gz: 6ba46ef732b848a7bddce203578b91b801ad5c8571b5b49443c300b9f74bcbba3519ecffac8e0bd25476e2de40d7d8b8f16ae4a4bc45cf4aa93f3d26270c7291
7
- data.tar.gz: d127335b24855d7b3cdd4725bca45b946e13d5712bc203fa972d0c79b16e719986b3d1c114bcb12df6ece8524c0af032c79f7fffd4ec46208dd03bb90d738c43
6
+ metadata.gz: 215336fcc2822b3ad8473742e7b5bf357e4c54aa2e044d6b0a2e85188d3f47f3a2906de2ae694bcd0e9db4db6f7f08f208fe69d118e698112bde38648e345575
7
+ data.tar.gz: 594d62ffac2d372f7afc745faffa35ea856767d8ca395f8045a4a35cccf6427741dea15a5d4b6a7a8a14e0371873ec9bffa7a0f1b4182d35132af44f7fffeb14
data/README.md CHANGED
@@ -133,35 +133,3 @@ end
133
133
 
134
134
  - Ruby 1.9.3 and up
135
135
  - Rails 3.2 to 4.2
136
-
137
- ## Building the gem
138
-
139
- To build the pure Ruby gem:
140
-
141
- ```sh
142
- $ rake gem
143
- ```
144
-
145
- To build with bundled pre-compiled C extensions:
146
-
147
- ```sh
148
- $ rake native gem
149
- ```
150
-
151
- For cross-compilation, see https://github.com/luislavena/rake-compiler#cross-compilation---the-future-is-now.
152
-
153
- ## Testing
154
-
155
- To run tests (under Rails 4.2):
156
-
157
- ```sh
158
- $ rake test
159
- ```
160
-
161
- To run tests under Rails 3.2:
162
-
163
- ```sh
164
- $ export RAILS_VERSION=3.2
165
- $ bundle update rails
166
- $ rake test
167
- ```
data/lib/immunio.rb CHANGED
@@ -22,6 +22,7 @@ module Immunio
22
22
  require_relative "immunio/plugins/authlogic"
23
23
  require_relative "immunio/plugins/redirect"
24
24
  require_relative "immunio/plugins/eval"
25
+ require_relative "immunio/plugins/metal"
25
26
 
26
27
  # Load and activate Rails engine
27
28
  require_relative "immunio/rails"
@@ -583,7 +583,9 @@ module Immunio
583
583
  # to a statement.
584
584
  def call(payload)
585
585
  Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
586
- Immunio.logger.debug { "New ActiveRecord SQL query: #{payload}" }
586
+ # The #{payload} in the log string is causing lots of Rails 3.2
587
+ # upstream test failures with Ruby 1.9.3.
588
+ # Immunio.logger.debug { "New ActiveRecord SQL query: #{payload}" }
587
589
 
588
590
  connection_id = payload[:connection_id]
589
591
 
@@ -15,7 +15,6 @@ module Immunio
15
15
  Immunio.new_request(request)
16
16
 
17
17
  Immunio.run_hook! "http_tracker", "http_request_start", meta_from_env(env)
18
- Immunio.run_hook! "http_tracker", "framework_route", route_name: route_name(env)
19
18
 
20
19
  env['rack.input'] = InputWrapper.new(env['rack.input'])
21
20
 
@@ -134,25 +133,6 @@ module Immunio
134
133
  }
135
134
  end
136
135
 
137
- def route_name(env)
138
- # Determine the route name in controller#action format:
139
- route_name = nil
140
-
141
- if defined?(Rails.application) && Rails.application.present?
142
- begin
143
- request = rack_request(env)
144
- path = request.env['PATH_INFO']
145
- method = request.env['REQUEST_METHOD'].downcase.to_sym
146
- url = Rails.application.routes.recognize_path(path, method: method)
147
- route_name = "#{url[:controller]}##{url[:action]}"
148
- rescue StandardError
149
- route_name = nil
150
- end
151
- end
152
-
153
- route_name
154
- end
155
-
156
136
  def session_was_loaded?(session)
157
137
  session && (session.respond_to?(:loaded?) ? session.loaded? : true)
158
138
  end
@@ -0,0 +1,33 @@
1
+ module Immunio
2
+ module MetalHook
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ if method_defined? :dispatch
7
+ Immunio::Utils.alias_method_chain self, :dispatch, :immunio
8
+ end
9
+ end
10
+
11
+ protected
12
+
13
+ def dispatch_with_immunio(name, request)
14
+ Request.time 'plugin', "#{Module.nesting[0]}::#{__method__}" do
15
+ route_name = "#{controller_path}##{name}"
16
+ Immunio.logger.debug { "MetalHook#dispatch: route_name: #{route_name}" }
17
+
18
+ Immunio.run_hook! 'metal', 'framework_route', route_name: route_name
19
+
20
+ Request.pause "plugin", "#{Module.nesting[0]}::#{__method__}" do
21
+ dispatch_without_immunio name, request
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ Immunio::Plugin.load(
29
+ 'ActionController (Metal)',
30
+ hooks: %w(framework_route)) do |plugin|
31
+ ActionController::Metal.send :include, Immunio::MetalHook
32
+ plugin.loaded! ActionPack::VERSION::STRING
33
+ end
data/lib/immunio/rails.rb CHANGED
@@ -15,7 +15,6 @@ module Immunio
15
15
  'http_request_body_chunk',
16
16
  'http_response_body_chunk',
17
17
  'exception',
18
- 'framework_route',
19
18
  'framework_session',
20
19
  ] do |plugin|
21
20
 
@@ -1,5 +1,5 @@
1
1
  module Immunio
2
2
  AGENT_TYPE = "agent-ruby"
3
- VERSION = "1.1.10"
3
+ VERSION = "1.1.11"
4
4
  VM_VERSION = "2.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immunio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immunio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -153,6 +153,7 @@ files:
153
153
  - lib/immunio/plugins/http_finisher.rb
154
154
  - lib/immunio/plugins/http_tracker.rb
155
155
  - lib/immunio/plugins/io.rb
156
+ - lib/immunio/plugins/metal.rb
156
157
  - lib/immunio/plugins/redirect.rb
157
158
  - lib/immunio/plugins/warden.rb
158
159
  - lib/immunio/processor.rb
@@ -465,7 +466,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
465
466
  version: '0'
466
467
  requirements: []
467
468
  rubyforge_project:
468
- rubygems_version: 2.4.5.1
469
+ rubygems_version: 2.6.10
469
470
  signing_key:
470
471
  specification_version: 4
471
472
  summary: Immunio Ruby agent