ddtrace 1.16.1 → 1.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/datadog/appsec/configuration/settings.rb +0 -6
- data/lib/datadog/appsec/contrib/rack/gateway/response.rb +0 -46
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +0 -5
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +0 -10
- data/lib/datadog/core/configuration/settings.rb +1 -1
- data/lib/ddtrace/version.rb +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: 31833e75aea54c0952a8c9bce646f0e75e304a3d9124f372c022a6bb5c700ea6
|
4
|
+
data.tar.gz: 6c487891f51fb0ef0c196fab1135f20d99417db62d82ee985cac621fb584f00a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d410408162b5ac03f8f80b8a18f5bd1adbcdd70625a45d288bd2f83a38b3b4668514d70ffd57c829d2ecfc9d7c2ac147ed831ccc7f45843ab51676fe501af2be
|
7
|
+
data.tar.gz: a76c4aef579a961e0d588577d42ea23ee2ab28f08fa75d29de2fd422e3e8a5c3543e3ea63ae260ddee054c0b4ffa38c469ece4307abac92d36c08d32a971b3f2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [1.16.2] - 2023-11-10
|
6
|
+
|
7
|
+
This release reverts a change to appsec response body parsing that was introduced in [1.16.0 ](https://github.com/DataDog/dd-trace-rb/releases/tag/v1.16.0) that may cause memory leaks.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
* Appsec: [Revert parse response body fix introduced in 1.16.0](https://github.com/DataDog/dd-trace-rb/pull/3153) ([#3252][])
|
11
|
+
|
5
12
|
## [1.16.1] - 2023-11-08
|
6
13
|
|
7
14
|
### Fixed
|
@@ -2627,7 +2634,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
2627
2634
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
2628
2635
|
|
2629
2636
|
|
2630
|
-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.16.
|
2637
|
+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.16.2...master
|
2638
|
+
[1.16.2]: https://github.com/DataDog/dd-trace-rb/compare/v1.16.1...v1.16.2
|
2631
2639
|
[1.16.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.16.0...v1.16.1
|
2632
2640
|
[1.16.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.15.0...v1.16.0
|
2633
2641
|
[1.15.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.14.0...v1.15.0
|
@@ -3841,6 +3849,7 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
3841
3849
|
[#3235]: https://github.com/DataDog/dd-trace-rb/issues/3235
|
3842
3850
|
[#3240]: https://github.com/DataDog/dd-trace-rb/issues/3240
|
3843
3851
|
[#3242]: https://github.com/DataDog/dd-trace-rb/issues/3242
|
3852
|
+
[#3252]: https://github.com/DataDog/dd-trace-rb/issues/3252
|
3844
3853
|
[@AdrianLC]: https://github.com/AdrianLC
|
3845
3854
|
[@Azure7111]: https://github.com/Azure7111
|
3846
3855
|
[@BabyGroot]: https://github.com/BabyGroot
|
@@ -19,55 +19,9 @@ module Datadog
|
|
19
19
|
@scope = scope
|
20
20
|
end
|
21
21
|
|
22
|
-
def parsed_body
|
23
|
-
return unless Datadog.configuration.appsec.parse_response_body
|
24
|
-
|
25
|
-
unless body.instance_of?(Array)
|
26
|
-
Datadog.logger.debug do
|
27
|
-
"Response body type unsupported: #{body.class}"
|
28
|
-
end
|
29
|
-
return
|
30
|
-
end
|
31
|
-
|
32
|
-
return unless json_content_type?
|
33
|
-
|
34
|
-
result = ''.dup
|
35
|
-
all_body_parts_are_string = true
|
36
|
-
|
37
|
-
body.each do |body_part|
|
38
|
-
if body_part.is_a?(String)
|
39
|
-
result.concat(body_part)
|
40
|
-
else
|
41
|
-
all_body_parts_are_string = false
|
42
|
-
break
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
return unless all_body_parts_are_string
|
47
|
-
|
48
|
-
begin
|
49
|
-
JSON.parse(result)
|
50
|
-
rescue JSON::ParserError => e
|
51
|
-
Datadog.logger.debug { "Failed to parse response body. Error #{e.class}. Message #{e.message}" }
|
52
|
-
nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
22
|
def response
|
57
23
|
@response ||= ::Rack::Response.new(body, status, headers)
|
58
24
|
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
VALID_JSON_TYPES = [
|
63
|
-
'application/json',
|
64
|
-
'text/json'
|
65
|
-
].freeze
|
66
|
-
|
67
|
-
def json_content_type?
|
68
|
-
content_type = headers['content-type']
|
69
|
-
VALID_JSON_TYPES.include?(content_type)
|
70
|
-
end
|
71
25
|
end
|
72
26
|
end
|
73
27
|
end
|
@@ -10,7 +10,6 @@ module Datadog
|
|
10
10
|
ADDRESSES = [
|
11
11
|
'response.status',
|
12
12
|
'response.headers',
|
13
|
-
'response.body',
|
14
13
|
].freeze
|
15
14
|
private_constant :ADDRESSES
|
16
15
|
|
@@ -18,7 +17,6 @@ module Datadog
|
|
18
17
|
catch(:block) do
|
19
18
|
op.publish('response.status', gateway_response.status)
|
20
19
|
op.publish('response.headers', gateway_response.headers)
|
21
|
-
op.publish('response.body', gateway_response.parsed_body)
|
22
20
|
|
23
21
|
nil
|
24
22
|
end
|
@@ -31,7 +29,6 @@ module Datadog
|
|
31
29
|
response_status = values[0]
|
32
30
|
response_headers = values[1]
|
33
31
|
response_headers_no_cookies = response_headers.dup.tap { |h| h.delete('set-cookie') }
|
34
|
-
response_body = values[2]
|
35
32
|
|
36
33
|
waf_args = {
|
37
34
|
'server.response.status' => response_status.to_s,
|
@@ -39,8 +36,6 @@ module Datadog
|
|
39
36
|
'server.response.headers.no_cookies' => response_headers_no_cookies,
|
40
37
|
}
|
41
38
|
|
42
|
-
waf_args['server.response.body'] = response_body if response_body
|
43
|
-
|
44
39
|
waf_timeout = Datadog.configuration.appsec.waf_timeout
|
45
40
|
result = waf_context.run(waf_args, waf_timeout)
|
46
41
|
|
@@ -66,16 +66,6 @@ module Datadog
|
|
66
66
|
request_return = AppSec::Response.negotiate(env, blocked_event.last[:actions]).to_rack if blocked_event
|
67
67
|
end
|
68
68
|
|
69
|
-
if request_return[2].respond_to?(:to_ary)
|
70
|
-
# Following the Rack specification. The response body should only call :each once.
|
71
|
-
# Calling :to_ary returns an array with identical content as the produced when calling :each
|
72
|
-
# replacing request_return[2] with that new value allow us to safely operate on the response body.
|
73
|
-
# On Gateway::Response#parsed_body we might iterate over the reposne body using :each
|
74
|
-
# https://github.com/rack/rack/blob/main/SPEC.rdoc#enumerable-body-
|
75
|
-
consumed_body = request_return[2].to_ary
|
76
|
-
request_return[2] = consumed_body if consumed_body
|
77
|
-
end
|
78
|
-
|
79
69
|
gateway_response = Gateway::Response.new(
|
80
70
|
request_return[2],
|
81
71
|
request_return[0],
|
@@ -330,7 +330,7 @@ module Datadog
|
|
330
330
|
# Caveat 3 (severe):
|
331
331
|
# Ruby 3.2.0 to 3.2.2 have a bug in the newobj tracepoint (https://bugs.ruby-lang.org/issues/19482,
|
332
332
|
# https://github.com/ruby/ruby/pull/7464) so that's an extra reason why it's not safe on those Rubies.
|
333
|
-
# This bug is fixed on Ruby versions 3.2.
|
333
|
+
# This bug is fixed on Ruby versions 3.2.3 and 3.3.0.
|
334
334
|
#
|
335
335
|
# @default `true` on Ruby 2.x and 3.1.4+, 3.2.3+ and 3.3.0+; `false` for Ruby 3.0 and unpatched Rubies.
|
336
336
|
option :allocation_counting_enabled do |o|
|
data/lib/ddtrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -890,7 +890,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
890
890
|
- !ruby/object:Gem::Version
|
891
891
|
version: 2.0.0
|
892
892
|
requirements: []
|
893
|
-
rubygems_version: 3.4.
|
893
|
+
rubygems_version: 3.4.1
|
894
894
|
signing_key:
|
895
895
|
specification_version: 4
|
896
896
|
summary: Datadog tracing code for your Ruby applications
|