tcell_agent 1.1.10 → 1.1.11

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: b84894f0c99387e227049af1f0cf23514630037a8a717b43283bcb19c66dfa37
4
- data.tar.gz: 7464cb57bee06eea3c94717334ef755b0acbef4768f836f39b8de7cdb85cb505
3
+ metadata.gz: 551e5d85f546219d1832b6392e84881eb019b670fc51f86d28be6dfa1b0f94ae
4
+ data.tar.gz: 2cc3d40b2ae1d360cc19c39c86428019c656e257ba55be60c39bc8235657fabf
5
5
  SHA512:
6
- metadata.gz: 60dabf811b67b4d762a8c39c96e47f7f3fff2e0287bb8586fec019976680b7c88efcbeb8e8ef541a8c719de0430a1c010e72ebaf7dfaffd03ff38b8c501fabca
7
- data.tar.gz: 4974dccf426c1113ffbd238ef8006dc8600fc01bcbd29fbf940c2c78df5f979c80f48888b7565fa8a3c998b71edc60973e2e97ddd08c8648224755b270af9ae9
6
+ metadata.gz: c4b5e2c2ef86eba52860ff5101508ac80fd55621b8381ff06e58a5cc19086bdc893b47103bc2c50c5d02ade6a8fb6a033058ec1df3c114d1f8ca6632c8b0d56a
7
+ data.tar.gz: c683422e7bc12498a73d1276df558be9b96e46e4882874e5d949a4fd390c63f351ab682b36a880b097d02390ff07e52a198e5b82a2c16cba101b6be3ec4f8d94
data/README.md CHANGED
@@ -1,120 +1,48 @@
1
- # TCellAgent [![Build Status](https://magnum.travis-ci.com/tcellio/rubyagent-tcell.svg?token=j7YU3iPt38CqCoDeM83P)](https://magnum.travis-ci.com/tcellio/rubyagent-tcell)
2
-
3
- TCell Agent - Instruments Rails
4
-
5
- ## Release Process Checklist
6
-
7
- Open a jira with the following checklist (sample: https://jira.tcell.io/browse/RA-98)
8
-
9
-
10
- [ X ] unit tests pass
11
- [ X ] integration tests pass
12
- [ X ] test-kit tests pass (all variants)
13
- [ X ] check test-kit logs for any unexpected errors
14
- [ X ] performance tests pass (https://github.com/tcellio/load-testing/tree/master/agents)
15
- [ X ] update changelog and version (sample https://github.com/tcellio/rubyagent-tcell/pull/275)
16
-
17
- [ X ] manual install verified working (`make build`, install gem globally: `gem install tcell_agent-x.x.x.gem` works properly)
18
- [ X ] run `tcell_agent test` command (might not be needed, since this is run in test-kit for every test-app)
19
-
20
- [ X ] Update Master Branch
21
-
22
- [ X ] ensure unknown_options accounts for any new keys (check `lib/tcell_agent/config/unknown_options.rb` file for logic)
23
- [ X ] update support page in wiki with any new support (https://tcellio.atlassian.net/wiki/spaces/EN/pages/54460460/Server+Agent+Support)
24
-
25
- Repeat if any bugs are found and patched
1
+ # RubyAgent
2
+ A Ruby security agent to instrument Ruby web applications. Additional docs can be found [here](https://docs.tcell.io/docs/ruby-agent-install)
3
+ ## Installation
26
4
 
27
- [ X ] merge master branch to release branch (this model was followed to make it easy to hotfix released versions)
5
+ Add this line to your Gemfile to install the gem directly from [RubyGems](https://rubygems.org)
28
6
 
29
- [ X ] create release in github repo with release notes and appropriate version tag (https://github.com/tcellio/rubyagent-tcell/releases)
30
- [ X ] run `make build` on release branch (`gem unpack tcell_agent-x.x.x.gem` and manually inspect .gem file to make sure no files are missing and no extra files are included)
31
- [ X ] upload to rubygems (`gem push tcell_agent-x.x.x.gem`)
32
- [ X ] confirm upload worked by running a test app that installs latest version from rubygems and smoke test
7
+ $ gem 'tcell_agent'
33
8
 
34
- Common Manual Tests Before Release
9
+ or to use a local version directly,
35
10
 
36
- Run a Test Kit test app with multiple worker processes and run the suite of tests against it (https://github.com/tcellio/tcell/compare/test-kit/run-multiple-worker-processes?expand=1)
11
+ $ gem 'tcell_agent', :path => '<path-to-gem-repo'
37
12
 
38
- Manually running a test app with multiple worker processes is temporary until this is implemented: https://jira.tcell.io/browse/TCEL-5298
13
+ and to install the gem,
39
14
 
40
- Smoke test a test app. Make sure agent can report appfw, you can post forms, you can login/log out. Test server configurations that you can't test with test-kit. Like multiple worker processes.
15
+ $ bundle install
41
16
 
42
- Special Things
17
+ ## Usage
43
18
 
44
- Config File - For rails applications config files are commonly stored in `config/` directory. Rubyagent is configured to look in `config/tcell_agent.config` by default for its configuration file.
19
+ Download the config file from the tCell dashboard and move it to the `config` directory of the application.
45
20
 
46
- Agent Home Owner - A customer experienced an issue where their web app master process ran as root but each worker process ran as a different user. This caused problems with the `tcell/` directory. If the master process created the directory then it was owned by root, so worker processes would raise permission exceptions when they tried to do any logging or write to the cache under the `tcell/`. `config.agent_home_owner` was introduced to allow the customer to specify the name of the user that should own `tcell/` so that worker process would not get permission exceptions when writing to it. This is no longer necessary with the newest agent version. The newest agent version doesn't do anything in the master process, everything is executed in the workers, so `tcell/` should have the correct permissions because it'll always be created by a worker process.
21
+ $ cp ~/Downloads/tcell_agent.config config/
47
22
 
48
- Rails Initializers: It's common for gems to be configured thru Rails initializers: https://guides.rubyonrails.org/v2.3/configuring.html#using-initializers. TCell rubyagent supports this as well. This means that certain rubyagent startup code that relies on configuration needs to run after Rails initializers have run. The rubyagent can be configured entirely thru initializers (as opposed to using tcell_agent.config file and/or ENV vars). Sample `config/initializers/tcell.rb` file:
23
+ When the server is started, tCell will be running. The log files will be created in the `tcell` directory of the project.
49
24
 
25
+ Alternatively, Rails initializers can be used instead of adding the `tcell_agent.config` file. The values for the fields can be found in `tcell_agent.config`. Here's a sample `config/initializers/tcell.rb`:
50
26
  ```
51
27
  if defined?(TCellAgent)
52
28
  TCellAgent.configure do |config|
53
29
  config.app_id = "---APP_ID---"
54
30
  config.api_key = "---API_KEY---"
55
- config.agent_log_dir = "/tmp/tcelllogs"
56
- config.agent_home_dir = "/tmp/tcellhome"
57
- config.tcell_api_url = "https://api.tcell-preview.io/api/v1"
58
- config.tcell_input_url = "https://input.tcell-preview.io/api/v1"
31
+ config.agent_log_dir = "---path-to-logs-dir---"
32
+ config.agent_home_dir = "--path-to-tcell-dir---"
33
+ config.tcell_api_url = ""
34
+ config.tcell_input_url = ""
59
35
  config.allow_payloads = true
60
- # Removed for ruby 2.0
61
- # config.agent_home_owner = "boris"
62
- config.enabled = true
63
- config.logging_options = {"enabled" => true, "level" => "DEBUG"}
64
- config.host_identifier = "foomyserver"
65
- config.log_tag = "TCELL_LOGS"
66
- # Removed for ruby 2.0
67
- # config.logger can no longer be supported after rubyagent v1.1.4 since logging is now handled by libtcellagent
68
- # config.logger = Rails.logger
69
- # or
70
- # config.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
71
36
  end
72
37
  end
73
38
  ```
74
39
 
75
- Heroku Deployments - Rails apps are commonly deployed to Heroku. The biggest impact that has on the rubyagent is the agent log file. Heroku doesn't provide access to the filesystem, so the rubyagent needs the ability to log to STDOUT instead of a file. `log_tag` and `logger` settings in configuration were introduced to support this.
76
-
77
- Log Tag (see above for example `log_tag` set in config) - Since rubyagent log can be printed to STDOUT along with all the other logging, `log_tag` is a custom string added to every log line to be able to filter just tcell log lines.
78
-
79
- Logger object - Up until rubyagent v1.1.4 you could set a Rails.logger for the rubyagent to use for its logging. With the migration to have libtcellagent handle logging, that use case can no longer be supported. This feature was mainly used to get the rubyagent to log to STDOUT in heroku deployments. So as long as the agent supports some config to allow to log to STDOUT, this won't be missed.
80
-
81
- ## Installation
82
-
83
- Download the GEM file and unpack it:
40
+ ## Troubleshooting
84
41
 
85
- $ curl -O https://s3-us-west-2.amazonaws.com/tcell-agent-download/duvm4dj/tcell_agent-0.2.0.gem
86
-
87
- In your rails directory
88
-
89
- $ mv tcell_agent-0.2.0.gem vendor/cache/
90
- $ bundle install
91
-
92
- Add this line to your application's Gemfile:
93
-
94
-
95
- ```ruby
96
- gem 'tcell_agent', '0.2.0'
97
- ```
98
- or if you're using the repository directly.
99
- ```ruby
100
- gem "tcell_agent", :path => "<path to your tcell_agent repo>"
42
+ Log level can be customized in `tcell_agent.config` by adding a block such as:
101
43
  ```
102
-
103
- And then execute:
104
-
105
- $ bundle
106
-
107
- ## Usage
108
-
109
- You can download the config file from the Agents section of the application then move it to the config directory
110
-
111
- $ cp ~/Downloads/tcell_agent.config config/
112
-
113
- Or run the helper command
114
-
115
- $ bundle exec tcell_agent setup
116
-
117
- Or if running from the repo:
118
-
119
- $ bundle exec <path to repo>/rubyagent-tcell/bin/tcell_agent
120
-
44
+ "logging_options": {
45
+ "enabled": true,
46
+ "level": "INFO"
47
+ }
48
+ ```
@@ -8,7 +8,7 @@ module TCellAgent
8
8
  module Wrapper
9
9
  extend FFI::Library
10
10
 
11
- VERSION = '1.3.1'.freeze
11
+ VERSION = '1.3.2'.freeze
12
12
  prefix = 'lib'
13
13
  extension = '.so'
14
14
  variant = ''
@@ -4,7 +4,7 @@ require 'tcell_agent/logger'
4
4
  require 'tcell_agent/utils/params'
5
5
  require 'cgi'
6
6
 
7
- TCELL_MAX_BODY_LENGTH = 20_000
7
+ TCELL_MAX_BODY_LENGTH = 50_000
8
8
 
9
9
  # TODO(ralba): move TCellData from instrumentation.rb here
10
10
  # and merge both models into one and drop usage of MetaData.
@@ -100,14 +100,13 @@ module TCellAgent
100
100
  end
101
101
 
102
102
  def headers_dict=(value)
103
- headers_dict = value.select do |k, _v|
104
- header_downcased = k.downcase
105
- (header_downcased != 'http_cookie' && header_downcased.start_with?('http_')) ||
106
- %w[content_type content_length].include?(header_downcased)
103
+ headers_dict = value.select do |header_key, _v|
104
+ (header_key != 'HTTP_COOKIE' && header_key.start_with?('HTTP_')) ||
105
+ %w[CONTENT_TYPE CONTENT_LENGTH].include?(header_key)
107
106
  end
108
107
 
109
108
  headers_dict = headers_dict.each_with_object({}) do |(k, v), memo|
110
- memo[k.downcase.sub(/^http_/, '').tr('_', '-')] = v
109
+ memo[k.sub(/^HTTP_/, '').tr('_', '-').downcase] = v
111
110
  end
112
111
  @flattened_headers_dict = TCellAgent::Utils::Params.flatten(headers_dict)
113
112
  end
@@ -121,18 +120,19 @@ module TCellAgent
121
120
  end
122
121
 
123
122
  def get_raw_post_data(request)
124
- if request.env.key?('RAW_POST_DATA')
125
- raw_post_data = request.env['RAW_POST_DATA']
126
- else
127
- body = request.body
128
- # Positions strio to the beginning of input, resetting lineno to zero.
129
- # rails 4.1 seems to read the stringIO directly and so body.gets is empty
130
- # this is called
131
- body.rewind if body.respond_to?(:rewind)
132
- raw_post_data = body.read(request.content_length.to_i) if request.content_length
133
- body.rewind if body.respond_to?(:rewind)
123
+ content_length = request.content_length.to_i if request.content_length
124
+ if !content_length.nil? && content_length > TCELL_MAX_BODY_LENGTH || request.content_type.nil?
125
+ return nil
134
126
  end
135
- raw_post_data if raw_post_data.respond_to?(:length) && raw_post_data.length < TCELL_MAX_BODY_LENGTH
127
+ raw_post_data = nil
128
+ # Positions strio to the beginning of input, resetting lineno to zero.
129
+ # rails 4.1 seems to read the stringIO directly and so body.gets is empty
130
+ # this is called
131
+ body.rewind if body.respond_to?(:rewind)
132
+ body = request.body
133
+ raw_post_data = body.read(request.content_length.to_i) if request.content_length
134
+ body.rewind if body.respond_to?(:rewind)
135
+ raw_post_data
136
136
  end
137
137
 
138
138
  def set_parameter_dicts(request)
@@ -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 = '1.1.10'.freeze
4
+ VERSION = '1.1.11'.freeze
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: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2019-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -160,11 +160,11 @@ files:
160
160
  - lib/tcell_agent/rails/settings_reporter.rb
161
161
  - lib/tcell_agent/rails/tcell_body_proxy.rb
162
162
  - lib/tcell_agent/routes/table.rb
163
- - lib/tcell_agent/rust/libtcellagent-1.3.1.dylib
164
- - lib/tcell_agent/rust/libtcellagent-1.3.1.so
165
- - lib/tcell_agent/rust/libtcellagent-alpine-1.3.1.so
163
+ - lib/tcell_agent/rust/libtcellagent-1.3.2.dylib
164
+ - lib/tcell_agent/rust/libtcellagent-1.3.2.so
165
+ - lib/tcell_agent/rust/libtcellagent-alpine-1.3.2.so
166
166
  - lib/tcell_agent/rust/models.rb
167
- - lib/tcell_agent/rust/tcellagent-1.3.1.dll
167
+ - lib/tcell_agent/rust/tcellagent-1.3.2.dll
168
168
  - lib/tcell_agent/rust/whisperer.rb
169
169
  - lib/tcell_agent/sensor_events/app_config.rb
170
170
  - lib/tcell_agent/sensor_events/appsensor_event.rb