sentry-ruby-core 4.6.5 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/sentry/client.rb +2 -2
- data/lib/sentry/configuration.rb +9 -0
- data/lib/sentry/dsn.rb +4 -0
- data/lib/sentry/hub.rb +4 -1
- data/lib/sentry/interfaces/request.rb +15 -2
- data/lib/sentry/scope.rb +1 -1
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +12 -0
- data/sentry-ruby-core.gemspec +1 -1
- data/sentry-ruby.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08bb1e6f6c55f8f9a206aabcb008ac4e8322652831108a0ec5145b69ed741c1d'
|
4
|
+
data.tar.gz: 7d699edbb8b0a1e05c44b0d039f2e9ea79cba7355961488f1bc9311e8a92cb14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6528918de5664c632d44c48cc04536cd41537e7fb2e5bc372c5794834cc4450b9d6aff82ba6ba4ad0a822ee5f96bc74a165ae6c1164299585019a187c63aad
|
7
|
+
data.tar.gz: 9cf4dcecb8d81ec03048d22ffc75a0d4647b70a4bf037e9183ff794ef044f1ece661218a4ca22aef89cdbb4992361b1c9829a5aeeab0179430afc420c2d8a01f
|
data/LICENSE.txt
CHANGED
data/lib/sentry/client.rb
CHANGED
@@ -57,10 +57,10 @@ module Sentry
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def event_from_message(message, hint = {})
|
60
|
+
def event_from_message(message, hint = {}, backtrace: nil)
|
61
61
|
integration_meta = Sentry.integrations[hint[:integration]]
|
62
62
|
event = Event.new(configuration: configuration, integration_meta: integration_meta, message: message)
|
63
|
-
event.add_threads_interface(backtrace: caller)
|
63
|
+
event.add_threads_interface(backtrace: backtrace || caller)
|
64
64
|
event
|
65
65
|
end
|
66
66
|
|
data/lib/sentry/configuration.rb
CHANGED
@@ -324,6 +324,15 @@ module Sentry
|
|
324
324
|
log_error("Error detecting release", e, debug: debug)
|
325
325
|
end
|
326
326
|
|
327
|
+
def csp_report_uri
|
328
|
+
if dsn && dsn.valid?
|
329
|
+
uri = dsn.csp_report_uri
|
330
|
+
uri += "&sentry_release=#{CGI.escape(release)}" if release && !release.empty?
|
331
|
+
uri += "&sentry_environment=#{CGI.escape(environment)}" if environment && !environment.empty?
|
332
|
+
uri
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
327
336
|
private
|
328
337
|
|
329
338
|
def excluded_exception?(incoming_exception)
|
data/lib/sentry/dsn.rb
CHANGED
data/lib/sentry/hub.rb
CHANGED
@@ -108,7 +108,8 @@ module Sentry
|
|
108
108
|
|
109
109
|
options[:hint] ||= {}
|
110
110
|
options[:hint][:message] = message
|
111
|
-
|
111
|
+
backtrace = options.delete(:backtrace)
|
112
|
+
event = current_client.event_from_message(message, options[:hint], backtrace: backtrace)
|
112
113
|
capture_event(event, **options, &block)
|
113
114
|
end
|
114
115
|
|
@@ -135,6 +136,8 @@ module Sentry
|
|
135
136
|
end
|
136
137
|
|
137
138
|
def add_breadcrumb(breadcrumb, hint: {})
|
139
|
+
return unless configuration.enabled_in_current_env?
|
140
|
+
|
138
141
|
if before_breadcrumb = current_client.configuration.before_breadcrumb
|
139
142
|
breadcrumb = before_breadcrumb.call(breadcrumb, hint)
|
140
143
|
end
|
@@ -57,7 +57,7 @@ module Sentry
|
|
57
57
|
request.POST
|
58
58
|
elsif request.body # JSON requests, etc
|
59
59
|
data = request.body.read(MAX_BODY_LIMIT)
|
60
|
-
data =
|
60
|
+
data = encode_to_utf_8(data.to_s)
|
61
61
|
request.body.rewind
|
62
62
|
data
|
63
63
|
end
|
@@ -76,7 +76,8 @@ module Sentry
|
|
76
76
|
# Rack stores headers as HTTP_WHAT_EVER, we need What-Ever
|
77
77
|
key = key.sub(/^HTTP_/, "")
|
78
78
|
key = key.split('_').map(&:capitalize).join('-')
|
79
|
-
|
79
|
+
|
80
|
+
memo[key] = encode_to_utf_8(value.to_s)
|
80
81
|
rescue StandardError => e
|
81
82
|
# Rails adds objects to the Rack env that can sometimes raise exceptions
|
82
83
|
# when `to_s` is called.
|
@@ -87,6 +88,18 @@ module Sentry
|
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
91
|
+
def encode_to_utf_8(value)
|
92
|
+
if value.encoding != Encoding::UTF_8 && value.respond_to?(:force_encoding)
|
93
|
+
value = value.dup.force_encoding(Encoding::UTF_8)
|
94
|
+
end
|
95
|
+
|
96
|
+
if !value.valid_encoding?
|
97
|
+
value = value.scrub
|
98
|
+
end
|
99
|
+
|
100
|
+
value
|
101
|
+
end
|
102
|
+
|
90
103
|
def is_skippable_header?(key)
|
91
104
|
key.upcase != key || # lower-case envs aren't real http headers
|
92
105
|
key == "HTTP_COOKIE" || # Cookies don't go here, they go somewhere else
|
data/lib/sentry/scope.rb
CHANGED
@@ -23,6 +23,7 @@ module Sentry
|
|
23
23
|
event.user = user.merge(event.user)
|
24
24
|
event.extra = extra.merge(event.extra)
|
25
25
|
event.contexts = contexts.merge(event.contexts)
|
26
|
+
event.transaction = transaction_name if transaction_name
|
26
27
|
|
27
28
|
if span
|
28
29
|
event.contexts[:trace] = span.get_trace_context
|
@@ -30,7 +31,6 @@ module Sentry
|
|
30
31
|
|
31
32
|
event.fingerprint = fingerprint
|
32
33
|
event.level = level
|
33
|
-
event.transaction = transaction_names.last
|
34
34
|
event.breadcrumbs = breadcrumbs
|
35
35
|
event.rack_env = rack_env if rack_env
|
36
36
|
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
@@ -90,6 +90,18 @@ module Sentry
|
|
90
90
|
@background_worker = Sentry::BackgroundWorker.new(config)
|
91
91
|
end
|
92
92
|
|
93
|
+
# Returns an uri for security policy reporting that's generated from the given DSN
|
94
|
+
# (To learn more about security policy reporting: https://docs.sentry.io/product/security-policy-reporting/)
|
95
|
+
#
|
96
|
+
# It returns nil if
|
97
|
+
#
|
98
|
+
# 1. The SDK is not initialized yet.
|
99
|
+
# 2. The DSN is not provided or is invalid.
|
100
|
+
def csp_report_uri
|
101
|
+
return unless initialized?
|
102
|
+
configuration.csp_report_uri
|
103
|
+
end
|
104
|
+
|
93
105
|
# Returns the main thread's active hub.
|
94
106
|
def get_main_hub
|
95
107
|
@main_hub
|
data/sentry-ruby-core.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ["Sentry Team"]
|
7
7
|
spec.description = spec.summary = "A gem that provides a client interface for the Sentry error logger"
|
8
8
|
spec.email = "accounts@sentry.io"
|
9
|
-
spec.license = '
|
9
|
+
spec.license = 'MIT'
|
10
10
|
spec.homepage = "https://github.com/getsentry/sentry-ruby"
|
11
11
|
|
12
12
|
spec.platform = Gem::Platform::RUBY
|
data/sentry-ruby.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ["Sentry Team"]
|
7
7
|
spec.description = spec.summary = "A gem that provides a client interface for the Sentry error logger"
|
8
8
|
spec.email = "accounts@sentry.io"
|
9
|
-
spec.license = '
|
9
|
+
spec.license = 'MIT'
|
10
10
|
spec.homepage = "https://github.com/getsentry/sentry-ruby"
|
11
11
|
|
12
12
|
spec.platform = Gem::Platform::RUBY
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-ruby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -103,7 +103,7 @@ files:
|
|
103
103
|
- sentry-ruby.gemspec
|
104
104
|
homepage: https://github.com/getsentry/sentry-ruby
|
105
105
|
licenses:
|
106
|
-
-
|
106
|
+
- MIT
|
107
107
|
metadata:
|
108
108
|
homepage_uri: https://github.com/getsentry/sentry-ruby
|
109
109
|
source_code_uri: https://github.com/getsentry/sentry-ruby
|