tcell_agent 0.2.22 → 0.2.23

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
  SHA1:
3
- metadata.gz: 0436d6cc489b525b048c92ac39ca316368c5fb90
4
- data.tar.gz: 09b162b17a7d373de8eaeba59d192c30d2fbb1c2
3
+ metadata.gz: f7c1c47e22a203a4c466d43a4b91f1bf23c08d73
4
+ data.tar.gz: c8fd4777d74973ed594c6db41d64a5f20909dd62
5
5
  SHA512:
6
- metadata.gz: b244fce3ca335f9a524e286fe214915656485209eb3be501abc5ecf891a31133b9c116b4e8b929123752b56343607918e96252f4b1b0da8b165c8170cc13c266
7
- data.tar.gz: 16eebbdcf0a19dbb64c106fc8f2ff43521a95317d2da3bf2414c88f5de22ca5b6e09570f775073c0dcca4f6f7a0d622c6ce11d77778f3395b4dd89fdd9a9d0ea
6
+ metadata.gz: 19291ca9491e12d54e0899ce3f76448bb484d78aeea332defded1132d9c1fc67c739d06d9ff3f7ef567cb767b67f7278f4aa56242cbe52c027778b99ff858ac8
7
+ data.tar.gz: ab5437c6dfdcb8d1b92327a05632f9d7b7e901e945fee90e4ea6e55a96f8217987da1ee7e1ef128eb49921c61e82434e8d2ab576148fe1cd0c7a655996890663
@@ -106,14 +106,12 @@ module TCellAgent
106
106
 
107
107
  next unless clazz
108
108
 
109
- if enabled
110
- sensors.push(clazz.new(
111
- {
112
- "enabled" => enabled,
113
- "v1_compatability_enabled" => true
114
- }
115
- ))
116
- end
109
+ sensors.push(clazz.new(
110
+ {
111
+ "enabled" => enabled,
112
+ "v1_compatability_enabled" => true
113
+ }
114
+ ))
117
115
  end
118
116
 
119
117
  elsif version == 2
@@ -51,12 +51,14 @@ module TCellAgent
51
51
  ip_info["ip"]
52
52
  end
53
53
 
54
- block_rule = TCellAgent::Patches::BlockRule.from_json( {
55
- "ips" => blocked_ips
56
- })
57
-
58
- if block_rule
59
- patches_policy.block_rules.push(block_rule)
54
+ if blocked_ips.size > 0
55
+ block_rule = TCellAgent::Patches::BlockRule.from_json( {
56
+ "ips" => blocked_ips
57
+ })
58
+
59
+ if block_rule
60
+ patches_policy.block_rules.push(block_rule)
61
+ end
60
62
  end
61
63
  end
62
64
 
@@ -1,28 +1,28 @@
1
1
  require 'tcell_agent/instrumentation'
2
2
 
3
3
  module TCellAgent
4
- class MyRailtie < Rails::Railtie
5
-
6
- initializer "tcell.sensors" do |app|
7
- ActiveSupport.on_load :action_controller do
8
4
 
9
- ActionController::RequestForgeryProtection.module_eval do
10
- alias_method :tcell_handle_unverified_request, :handle_unverified_request
11
- def handle_unverified_request
12
- TCellAgent::Instrumentation.safe_block("AppSensor CSRF Exception processing") do
13
- appsensor_policy = TCellAgent.policy(TCellAgent::PolicyTypes::AppSensor)
14
- if appsensor_policy
15
- tcell_data = request.env[TCellAgent::Instrumentation::TCELL_ID]
16
- if tcell_data
17
- appsensor_policy.csrf_rejected(tcell_data, ActionController::InvalidAuthenticityToken)
18
- end
19
- end
20
- end
21
-
22
- tcell_handle_unverified_request
5
+ module CsrfExceptionReporter
6
+ def handle_unverified_request
7
+ TCellAgent::Instrumentation.safe_block("AppSensor CSRF Exception processing") do
8
+ appsensor_policy = TCellAgent.policy(TCellAgent::PolicyTypes::AppSensor)
9
+ if appsensor_policy
10
+ tcell_data = request.env[TCellAgent::Instrumentation::TCELL_ID]
11
+ if tcell_data
12
+ appsensor_policy.csrf_rejected(tcell_data, ActionController::InvalidAuthenticityToken)
23
13
  end
24
14
  end
15
+ end
25
16
 
17
+ super if defined?(super)
18
+ end
19
+ end
20
+
21
+ class MyRailtie < Rails::Railtie
22
+
23
+ initializer "tcell.sensors" do |app|
24
+ ActiveSupport.on_load :action_controller do
25
+ ActionController::Base.send(:include, TCellAgent::CsrfExceptionReporter)
26
26
  end
27
27
  end
28
28
 
@@ -1,5 +1,5 @@
1
1
  # See the file "LICENSE" for the full license governing this code.
2
2
 
3
3
  module TCellAgent
4
- VERSION = "0.2.22"
4
+ VERSION = "0.2.23"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tcell_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
4
+ version: 0.2.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-20 00:00:00.000000000 Z
11
+ date: 2016-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client