appmap 0.83.6 → 0.84.0

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: bf377e8a1059017ed00e26a5749cf98e625448447b340301b7c69061a30c41be
4
- data.tar.gz: 1e0cf2c3cd43e33a5e12ed51a14377a3646f6ff67626acef693b4679b6302d0e
3
+ metadata.gz: bc5d48a877bd0953d1d374fcabfa23bf584ac81bd4f303d4f759fb531a778b22
4
+ data.tar.gz: 6fe7282152760a910275176ea36987747671e4d06d3983b41ac04edfc217d22c
5
5
  SHA512:
6
- metadata.gz: 385200372fe060a8344d313493a2911bc8111796bd70318efb751fa64432ce217a2fc77b34cae5d71c056a98628c78993dec985fc91c78f80bed4469415313d1
7
- data.tar.gz: fa1e1dd2e47f4fc4098a4a1b1617891dc1b00e071da2142ee59657fc80e34771c02ffd2dba37b1a3ea0c5c9e53a289fa19ba3b78b1f8ba8d5d4a0a7b1cb6725e
6
+ metadata.gz: 3385416af1ca8318f5e08fe8edc242be03e7e40b8c15a5a68e6ec0678915cd3ca37a3948bf2651db20f2d56dc3b9ba93dda777a5d21ebcd134de252c78d5af91
7
+ data.tar.gz: 67ee12c6708a5e29e86462d086b0509db2d4c0b05643182b9ea5209d4acfe792d52532bb3314a48911c07e7d1891a2a32868a55feb13455172e7571c1b7a3570
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [0.84.0](https://github.com/applandinc/appmap-ruby/compare/v0.83.6...v0.84.0) (2022-08-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Address stack overflow error with tracing? ([f426210](https://github.com/applandinc/appmap-ruby/commit/f426210b8dfb48987f2b6c1b5e57e80e3a2c921d))
7
+ * Handle nil class names ([263f2fc](https://github.com/applandinc/appmap-ruby/commit/263f2fc97b716f1a8205a3e85292c59ee19bc6bc))
8
+
9
+
10
+ ### Features
11
+
12
+ * Label ActiveSupport::MessageEncryptor ([38a7aeb](https://github.com/applandinc/appmap-ruby/commit/38a7aeb446a2baa63f6724eea8dcf36276d336c9))
13
+ * Label crypto function with algorithm name ([a7a9c61](https://github.com/applandinc/appmap-ruby/commit/a7a9c6145790fc5bc425e413d56984ef777f9fd1))
14
+ * Label EncryptedKeyRotatingCookieJar.commit ([8e1d015](https://github.com/applandinc/appmap-ruby/commit/8e1d0158d25f2cc386c32ba899085fd21fadafcb))
15
+ * Label OpenSSL::Random ([5c947a9](https://github.com/applandinc/appmap-ruby/commit/5c947a90037300639a94ab89d9e1a4dca26265bc))
16
+ * Label Random ([7572803](https://github.com/applandinc/appmap-ruby/commit/7572803991693ad80f8526c44056133cca13d4b8))
17
+ * Label the rest of OpenSSL::Cipher ([7863b7b](https://github.com/applandinc/appmap-ruby/commit/7863b7b3fcf2ecccda16b80e637e216c06a95108))
18
+ * Make activesupport a runtime dependency ([140a674](https://github.com/applandinc/appmap-ruby/commit/140a6744be2abf47d01e880a98f1dd06c8a505b1))
19
+
1
20
  ## [0.83.6](https://github.com/applandinc/appmap-ruby/compare/v0.83.5...v0.83.6) (2022-08-01)
2
21
 
3
22
 
data/appmap.gemspec CHANGED
@@ -27,11 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.extensions << "ext/appmap/extconf.rb"
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency 'activesupport'
31
30
  spec.add_dependency 'method_source'
32
31
  spec.add_dependency 'rack'
33
32
  spec.add_dependency 'reverse_markdown'
34
33
 
34
+ spec.add_runtime_dependency 'activesupport'
35
+
35
36
  spec.add_development_dependency 'bundler', '>= 1.16'
36
37
  spec.add_development_dependency 'minitest', '~> 5.15'
37
38
  spec.add_development_dependency 'pry-byebug'
data/lib/appmap/agent.rb CHANGED
@@ -57,6 +57,12 @@ module AppMap
57
57
  end
58
58
  end
59
59
 
60
+ def tracing_enabled?
61
+ return false unless @tracing
62
+
63
+ @tracing.enabled?
64
+ end
65
+
60
66
  # Used to start tracing, stop tracing, and record events.
61
67
  def tracing
62
68
  @tracing ||= Trace::Tracing.new
@@ -14,3 +14,9 @@
14
14
  label: deserialize.safe
15
15
  require_name: active_support/lazy_load_hooks
16
16
  force: true
17
+ - method: ActiveSupport::MessageEncryptor#encrypt_and_sign
18
+ require_name: active_support/message_encryptor
19
+ force: true
20
+ - method: ActiveSupport::MessageEncryptor#decrypt_and_verifdy
21
+ require_name: active_support/message_encryptor
22
+ force: true
@@ -1,3 +1,3 @@
1
1
  - method: Net::HTTP#request
2
2
  label: protocol.http
3
- handler_class: AppMap::Handler::NetHTTP
3
+ handler_class: AppMap::Handler::NetHTTPHandler
@@ -12,5 +12,39 @@
12
12
  label: crypto.pkcs5
13
13
  - method: OpenSSL::Cipher#encrypt
14
14
  label: crypto.encrypt
15
+ handler_class: AppMap::Handler::OpenSSLHandler
15
16
  - method: OpenSSL::Cipher#decrypt
16
17
  label: crypto.decrypt
18
+ handler_class: AppMap::Handler::OpenSSLHandler
19
+ - method: OpenSSL::Cipher#auth_data=
20
+ label: crypto.set_auth_data
21
+ - method: OpenSSL::Cipher#auth_tag=
22
+ label: crypto.set_auth_tag
23
+ - method: OpenSSL::Cipher#auth_tag_len=
24
+ label: crypto.set_auth_tag_len
25
+ - method: OpenSSL::Cipher#ccm_data_len=
26
+ label: crypto.set_ccm_data_len
27
+ - method: OpenSSL::Cipher#iv=
28
+ label: crypto.set_iv
29
+ - method: OpenSSL::Cipher#iv_len=
30
+ label: crypto.set_iv_len
31
+ - method: OpenSSL::Cipher#key=
32
+ label: crypto.set_key
33
+ - method: OpenSSL::Cipher#key_len=
34
+ label: crypto.set_key_len
35
+ - method: OpenSSL::Cipher#padding=
36
+ label: crypto.set_padding
37
+ - method: OpenSSL::Cipher#final
38
+ label: crypto.final
39
+ - methods:
40
+ - OpenSSL::Cipher#random_iv
41
+ - OpenSSL::Cipher#random_key
42
+ - OpenSSL::Cipher#reset
43
+ - OpenSSL::Cipher#update
44
+ - methods:
45
+ - OpenSSL::Random.random_bytes
46
+ label: random.secure
47
+ - methods:
48
+ - OpenSSL::Random#add
49
+ - OpenSSL::Random#seed
50
+ label: pseudorandom.seed
@@ -18,7 +18,7 @@
18
18
  - Kernel#eval
19
19
  require_name: ruby
20
20
  label: lang.eval
21
- handler_class: AppMap::Handler::Eval
21
+ handler_class: AppMap::Handler::EvalHandler
22
22
  - methods:
23
23
  - IO#popen
24
24
  - Kernel#exec
data/lib/appmap/config.rb CHANGED
@@ -32,8 +32,8 @@ module AppMap
32
32
  attr_writer :handler_class
33
33
 
34
34
  def handler_class
35
- require 'appmap/handler/function'
36
- @handler_class || AppMap::Handler::Function
35
+ require 'appmap/handler/function_handler'
36
+ @handler_class || AppMap::Handler::FunctionHandler
37
37
  end
38
38
 
39
39
  # Indicates that only the entry points to a package will be recorded.
@@ -72,7 +72,7 @@ module AppMap
72
72
  # Builds a package for gem. Generally corresponds to a `gem:` entry in appmap.yml. Also used when mapping
73
73
  # a builtin.
74
74
  def build_from_gem(gem, shallow: true, require_name: nil, exclude: [], labels: [], optional: false, force: false)
75
- if !force && %w[method_source activesupport].member?(gem)
75
+ if !force && %w[method_source].member?(gem)
76
76
  warn "WARNING: #{gem} cannot be AppMapped because it is a dependency of the appmap gem"
77
77
  return
78
78
  end
data/lib/appmap/event.rb CHANGED
@@ -84,10 +84,10 @@ module AppMap
84
84
  # Heuristic for dynamically defined class whose name can be nil
85
85
  def best_class_name(value)
86
86
  value_cls = value.class
87
- while value_cls.name.nil?
87
+ while value_cls && value_cls.name.nil?
88
88
  value_cls = value_cls.superclass
89
89
  end
90
- value_cls.name
90
+ value_cls&.name || 'unknown'
91
91
  end
92
92
 
93
93
  def encode_display_string(value)
@@ -53,3 +53,5 @@
53
53
  labels:
54
54
  - deserialize.safe
55
55
  - lang.eval.safe
56
+ - methods: ActionDispatch::Cookies::EncryptedKeyRotatingCookieJar.commit
57
+ require_name: action_dispatch
@@ -0,0 +1,12 @@
1
+ - methods:
2
+ - Random.new_seed
3
+ - Random.rand
4
+ - Random.raw_seed
5
+ - Random.srand
6
+ - Random#bytes
7
+ - Random#rand
8
+ labels:
9
+ - pseudorandom
10
+ - random.insecure
11
+ - method: Random#seed
12
+ label: pseudorandom.seed
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'appmap/handler/function'
3
+ require 'appmap/handler/function_handler'
4
4
 
5
5
  module AppMap
6
6
  module Handler
@@ -14,15 +14,15 @@ module AppMap
14
14
  #
15
15
  # If the binding is not provided, by default eval will run in the
16
16
  # current frame. Since we call it here, this will mean the #do_call
17
- # frame, which would make AppMap::Handler::Eval the lexical scope
17
+ # frame, which would make AppMap::Handler::EvalHandler the lexical scope
18
18
  # for constant lookup and definition; as a consequence
19
19
  # eg. `eval "class Foo; end"` would define
20
- # AppMap::Handler::Eval::Foo instead of defining it in
20
+ # AppMap::Handler::EvalHandler::Foo instead of defining it in
21
21
  # the module where the original call was made.
22
22
  #
23
23
  # To avoid this, we explicitly substitute the correct execution
24
24
  # context, up several stack frames.
25
- class Eval < Function
25
+ class EvalHandler < FunctionHandler
26
26
  # The depth of the frame we need to pluck out:
27
27
  # 1. Hook::Method#do_call
28
28
  # 2. Hook::Method#trace_call
@@ -6,7 +6,7 @@ require 'appmap/hook/method'
6
6
  module AppMap
7
7
  module Handler
8
8
  # Base handler class, will emit method call and return events.
9
- class Function < Hook::Method
9
+ class FunctionHandler < Hook::Method
10
10
  def handle_call(receiver, args)
11
11
  AppMap::Event::MethodCall.build_from_invocation(defined_class, hook_method, receiver, args)
12
12
  end
@@ -29,7 +29,7 @@ module AppMap
29
29
 
30
30
  self.request_method = request.method
31
31
  self.url = url
32
- self.headers = NetHTTP.copy_headers(request)
32
+ self.headers = NetHTTPHandler.copy_headers(request)
33
33
  self.params = Rack::Utils.parse_nested_query(query)
34
34
  end
35
35
 
@@ -64,7 +64,7 @@ module AppMap
64
64
 
65
65
  if response
66
66
  self.status = response.code.to_i
67
- self.headers = NetHTTP.copy_headers(response)
67
+ self.headers = NetHTTPHandler.copy_headers(response)
68
68
  else
69
69
  self.headers = {}
70
70
  end
@@ -84,7 +84,7 @@ module AppMap
84
84
 
85
85
  # Handler class for HTTP requests.
86
86
  # Emits HTTP request events instead of method calls.
87
- class NetHTTP < Hook::Method
87
+ class NetHTTPHandler < Hook::Method
88
88
  def self.copy_headers(obj)
89
89
  {}.tap do |headers|
90
90
  obj.each_header do |key, value|
@@ -0,0 +1,16 @@
1
+ require 'appmap/handler/function_handler'
2
+
3
+ module AppMap
4
+ module Handler
5
+ class OpenSSLHandler < FunctionHandler
6
+ def handle_call(receiver, args)
7
+ super.tap do |event|
8
+ algorithm = receiver.name
9
+ event.receiver[:labels] ||= []
10
+ label = [ 'crypto.algorithm', algorithm ].join('.')
11
+ event.receiver[:labels] << label unless event.receiver[:labels].include?(label)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,9 +1,9 @@
1
- require 'appmap/handler/function'
1
+ require 'appmap/handler/function_handler'
2
2
 
3
3
  module AppMap
4
4
  module Handler
5
5
  module Rails
6
- class RenderHandler < AppMap::Handler::Function
6
+ class RenderHandler < AppMap::Handler::FunctionHandler
7
7
  def handle_call(receiver, args)
8
8
  options, _ = args
9
9
  # TODO: :file, :xml
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'appmap/handler/function'
3
+ require 'appmap/handler/function_handler'
4
4
  require 'appmap/event'
5
5
 
6
6
  module AppMap
@@ -110,7 +110,7 @@ module AppMap
110
110
  # Hooks the ActionView::Resolver methods +find_all+, +find_all_anywhere+. The resolver is used
111
111
  # during template rendering to lookup the template file path from parameters such as the
112
112
  # template name, prefix, and partial (boolean).
113
- class ResolverHandler < AppMap::Handler::Function
113
+ class ResolverHandler < AppMap::Handler::FunctionHandler
114
114
  def handle_call(receiver, args)
115
115
  name, prefix, partial = args
116
116
  warn "Resolver: #{{ name: name, prefix: prefix, partial: partial }}" if LOG
@@ -83,7 +83,7 @@ module AppMap
83
83
  end
84
84
 
85
85
  def trace?
86
- return false unless AppMap.tracing.enabled?
86
+ return false unless AppMap.tracing_enabled?
87
87
  return false if Thread.current[HOOK_DISABLE_KEY]
88
88
  return false if hook_package&.shallow? && AppMap.tracing.last_package_for_current_thread == hook_package
89
89
 
data/lib/appmap/util.rb CHANGED
@@ -193,6 +193,7 @@ module AppMap
193
193
  end
194
194
 
195
195
  def deep_dup(hash)
196
+ require 'active_support/core_ext'
196
197
  hash.deep_dup
197
198
  end
198
199
 
@@ -3,7 +3,7 @@
3
3
  module AppMap
4
4
  URL = 'https://github.com/applandinc/appmap-ruby'
5
5
 
6
- VERSION = '0.83.6'
6
+ VERSION = '0.84.0'
7
7
 
8
8
  APPMAP_FORMAT_VERSION = '1.7.0'
9
9
 
data/lib/appmap.rb CHANGED
@@ -20,13 +20,6 @@
20
20
  # - appmap/swagger (Rake task)
21
21
  # - appmap/depends (Rake task)
22
22
 
23
- begin
24
- require 'active_support'
25
- require 'active_support/core_ext'
26
- rescue NameError
27
- warn 'active_support is not available. AppMap execution will continue optimistically without it...'
28
- end
29
-
30
23
  require 'appmap/version'
31
24
  require 'appmap/agent'
32
25
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.83.6
4
+ version: 0.84.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Gilpin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-01 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: method_source
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: method_source
28
+ name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rack
42
+ name: reverse_markdown
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: reverse_markdown
56
+ name: activesupport
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -353,6 +353,7 @@ files:
353
353
  - ext/appmap/extconf.rb
354
354
  - lib/appmap.rb
355
355
  - lib/appmap/agent.rb
356
+ - lib/appmap/builtin_hooks/activesupport.yml
356
357
  - lib/appmap/builtin_hooks/json.yml
357
358
  - lib/appmap/builtin_hooks/logger.yml
358
359
  - lib/appmap/builtin_hooks/net/http.yml
@@ -383,19 +384,20 @@ files:
383
384
  - lib/appmap/gem_hooks/activejob-cancel.yml
384
385
  - lib/appmap/gem_hooks/activejob.yml
385
386
  - lib/appmap/gem_hooks/activerecord.yml
386
- - lib/appmap/gem_hooks/activesupport.yml
387
387
  - lib/appmap/gem_hooks/cancancan.yml
388
388
  - lib/appmap/gem_hooks/devise.yml
389
389
  - lib/appmap/gem_hooks/pandoc-ruby.yml
390
390
  - lib/appmap/gem_hooks/rails.yml
391
391
  - lib/appmap/gem_hooks/railties.yml
392
+ - lib/appmap/gem_hooks/random.yml
392
393
  - lib/appmap/gem_hooks/resque.yml
393
394
  - lib/appmap/gem_hooks/sidekiq.yml
394
395
  - lib/appmap/gem_hooks/sprockets.yml
395
396
  - lib/appmap/handler.rb
396
- - lib/appmap/handler/eval.rb
397
- - lib/appmap/handler/function.rb
398
- - lib/appmap/handler/net_http.rb
397
+ - lib/appmap/handler/eval_handler.rb
398
+ - lib/appmap/handler/function_handler.rb
399
+ - lib/appmap/handler/net_http_handler.rb
400
+ - lib/appmap/handler/open_ssl_handler.rb
399
401
  - lib/appmap/handler/rails/render_handler.rb
400
402
  - lib/appmap/handler/rails/request_handler.rb
401
403
  - lib/appmap/handler/rails/sql_handler.rb