libddwaf 1.24.1.0.3 → 1.24.1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/lib/datadog/appsec/waf/converter.rb +30 -9
- data/lib/datadog/appsec/waf/handle.rb +3 -1
- data/lib/datadog/appsec/waf/lib_ddwaf.rb +8 -0
- data/lib/datadog/appsec/waf/version.rb +1 -1
- data/sig/datadog/appsec/waf/converter.rbs +1 -1
- data/sig/datadog/appsec/waf/handle.rbs +1 -1
- data/sig/datadog/appsec/waf/lib_ddwaf.rbs +3 -0
- data/sig/datadog/appsec/waf.rbs +2 -0
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6129d8e1c3cb329d09e1271c780312f926421c7312105e91cc2a7854ab1ef08
|
4
|
+
data.tar.gz: 412d369a4e51881f4f5754efe7e6ede6557258a84b57ef37f7dec7a95271c652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 570526a46b603ef3aa5399453633fc6ba8092f808af5c416b5954d08c7c619c81a4e71dfb038b570db876a39b0905e1d29d916cf97e2796c6fff13cb8ed9285a
|
7
|
+
data.tar.gz: dc8d47b1bbb2305a2428e111f73d683afeee0831e74850cae859f09ef6047f25aaa8dd6cae908dec300284027d34ac8855c68d1a0aab7dcedb5c925ae6a05fe9
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1
|
-
# Unreleased
|
1
|
+
# Unreleased
|
2
|
+
|
3
|
+
# 2025-08-15 v1.24.1.1.0
|
4
|
+
|
5
|
+
## Added
|
6
|
+
|
7
|
+
- Add `LibDDWAF::Object#input_truncated?` method that returns true if the input object was truncated during conversion to libddwaf object
|
8
|
+
|
9
|
+
## Changed
|
10
|
+
|
11
|
+
- Change `Handle#known_addresses` to cache the result
|
12
|
+
|
13
|
+
# 2025-05-20 v1.24.1.0.0
|
2
14
|
|
3
15
|
## Added
|
4
16
|
|
@@ -8,7 +8,7 @@ module Datadog
|
|
8
8
|
module_function
|
9
9
|
|
10
10
|
# standard:disable Metrics/MethodLength,Metrics/CyclomaticComplexity
|
11
|
-
def ruby_to_object(val, max_container_size: nil, max_container_depth: nil, max_string_length: nil, coerce: true)
|
11
|
+
def ruby_to_object(val, max_container_size: nil, max_container_depth: nil, max_string_length: nil, top_obj: nil, coerce: true)
|
12
12
|
case val
|
13
13
|
when Array
|
14
14
|
obj = LibDDWAF::Object.new
|
@@ -16,19 +16,25 @@ module Datadog
|
|
16
16
|
raise ConversionError, "Could not convert into object: #{val}" if res.null?
|
17
17
|
|
18
18
|
max_index = max_container_size - 1 if max_container_size
|
19
|
-
|
19
|
+
if max_container_depth == 0
|
20
|
+
top_obj&.mark_as_input_truncated!
|
21
|
+
else
|
20
22
|
val.each.with_index do |e, i|
|
21
23
|
member = Converter.ruby_to_object(
|
22
24
|
e,
|
23
25
|
max_container_size: max_container_size,
|
24
26
|
max_container_depth: (max_container_depth - 1 if max_container_depth),
|
25
27
|
max_string_length: max_string_length,
|
28
|
+
top_obj: top_obj || obj,
|
26
29
|
coerce: coerce
|
27
30
|
)
|
28
31
|
e_res = LibDDWAF.ddwaf_object_array_add(obj, member)
|
29
32
|
raise ConversionError, "Could not add to array object: #{e.inspect}" unless e_res
|
30
33
|
|
31
|
-
|
34
|
+
if max_index && i >= max_index
|
35
|
+
(top_obj || obj).mark_as_input_truncated!
|
36
|
+
break val
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
@@ -39,24 +45,33 @@ module Datadog
|
|
39
45
|
raise ConversionError, "Could not convert into object: #{val}" if res.null?
|
40
46
|
|
41
47
|
max_index = max_container_size - 1 if max_container_size
|
42
|
-
|
48
|
+
if max_container_depth == 0
|
49
|
+
top_obj&.mark_as_input_truncated!
|
50
|
+
else
|
43
51
|
val.each.with_index do |e, i|
|
44
52
|
# for Steep, which doesn't handle |(k, v), i|
|
45
53
|
k = e[0]
|
46
54
|
v = e[1]
|
47
55
|
|
48
|
-
|
56
|
+
if max_string_length && k.length > max_string_length
|
57
|
+
k = k.to_s[0, max_string_length]
|
58
|
+
(top_obj || obj).mark_as_input_truncated!
|
59
|
+
end
|
49
60
|
member = Converter.ruby_to_object(
|
50
61
|
v,
|
51
62
|
max_container_size: max_container_size,
|
52
63
|
max_container_depth: (max_container_depth - 1 if max_container_depth),
|
53
64
|
max_string_length: max_string_length,
|
65
|
+
top_obj: top_obj || obj,
|
54
66
|
coerce: coerce
|
55
67
|
)
|
56
68
|
kv_res = LibDDWAF.ddwaf_object_map_addl(obj, k.to_s, k.to_s.bytesize, member)
|
57
69
|
raise ConversionError, "Could not add to map object: #{k.inspect} => #{v.inspect}" unless kv_res
|
58
70
|
|
59
|
-
|
71
|
+
if max_index && i >= max_index
|
72
|
+
(top_obj || obj).mark_as_input_truncated!
|
73
|
+
break val
|
74
|
+
end
|
60
75
|
end
|
61
76
|
end
|
62
77
|
|
@@ -64,15 +79,21 @@ module Datadog
|
|
64
79
|
when String
|
65
80
|
obj = LibDDWAF::Object.new
|
66
81
|
encoded_val = val.to_s.encode(Encoding::UTF_8, invalid: :replace, undef: :replace)
|
67
|
-
|
68
|
-
|
82
|
+
if max_string_length && encoded_val.length > max_string_length
|
83
|
+
encoded_val = encoded_val[0, max_string_length]
|
84
|
+
(top_obj || obj).mark_as_input_truncated!
|
85
|
+
end
|
86
|
+
str = encoded_val.to_s
|
69
87
|
res = LibDDWAF.ddwaf_object_stringl(obj, str, str.bytesize)
|
70
88
|
raise ConversionError, "Could not convert into object: #{val.inspect}" if res.null?
|
71
89
|
|
72
90
|
obj
|
73
91
|
when Symbol
|
74
92
|
obj = LibDDWAF::Object.new
|
75
|
-
|
93
|
+
if max_string_length
|
94
|
+
val = val.to_s[0, max_string_length]
|
95
|
+
(top_obj || obj).mark_as_input_truncated!
|
96
|
+
end
|
76
97
|
str = val.to_s
|
77
98
|
res = LibDDWAF.ddwaf_object_stringl(obj, str, str.bytesize)
|
78
99
|
raise ConversionError, "Could not convert into object: #{val.inspect}" if res.null?
|
@@ -37,6 +37,8 @@ module Datadog
|
|
37
37
|
#
|
38
38
|
# @return [Array<String>] the list of known addresses
|
39
39
|
def known_addresses
|
40
|
+
return @known_addresses if defined?(@known_addresses)
|
41
|
+
|
40
42
|
ensure_pointer_presence!
|
41
43
|
|
42
44
|
count = LibDDWAF::UInt32Ptr.new
|
@@ -44,7 +46,7 @@ module Datadog
|
|
44
46
|
|
45
47
|
return [] if count == 0 # list is null
|
46
48
|
|
47
|
-
list.get_array_of_string(0, count[:value])
|
49
|
+
@known_addresses = list.get_array_of_string(0, count[:value]).compact
|
48
50
|
end
|
49
51
|
|
50
52
|
private
|
@@ -136,6 +136,14 @@ module Datadog
|
|
136
136
|
:valueUnion, ObjectValueUnion,
|
137
137
|
:nbEntries, :uint64,
|
138
138
|
:type, :ddwaf_obj_type
|
139
|
+
|
140
|
+
def input_truncated?
|
141
|
+
@input_truncated == true
|
142
|
+
end
|
143
|
+
|
144
|
+
def mark_as_input_truncated!
|
145
|
+
@input_truncated = true
|
146
|
+
end
|
139
147
|
end
|
140
148
|
|
141
149
|
typedef Object.by_ref, :ddwaf_object
|
@@ -5,7 +5,7 @@ module Datadog
|
|
5
5
|
BASE_STRING = "1.24.1"
|
6
6
|
# NOTE: Every change to the `BASE_STRING` should be accompanied
|
7
7
|
# by a reset of the patch version in the `STRING` below.
|
8
|
-
STRING = "#{BASE_STRING}.0
|
8
|
+
STRING = "#{BASE_STRING}.1.0"
|
9
9
|
MINIMUM_RUBY_VERSION = "2.5"
|
10
10
|
end
|
11
11
|
end
|
@@ -2,7 +2,7 @@ module Datadog
|
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
4
|
module Converter
|
5
|
-
def self.ruby_to_object: (top val, ?max_container_size: ::Integer?, ?max_container_depth: ::Integer?, ?max_string_length: ::Integer?, ?coerce: bool?) -> LibDDWAF::Object
|
5
|
+
def self.ruby_to_object: (top val, ?max_container_size: ::Integer?, ?max_container_depth: ::Integer?, ?max_string_length: ::Integer?, ?top_obj: LibDDWAF::Object?, ?coerce: bool?) -> LibDDWAF::Object
|
6
6
|
|
7
7
|
def self.object_to_ruby: (LibDDWAF::Object obj) -> WAF::data
|
8
8
|
end
|
data/sig/datadog/appsec/waf.rbs
CHANGED
@@ -2,6 +2,8 @@ module Datadog
|
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
4
|
type data = String | Symbol | Integer | Float | TrueClass | FalseClass | Array[data] | Hash[(String | Symbol | nil), data] | nil
|
5
|
+
type known_addresses = ::Array[::String]
|
6
|
+
type diagnostics = ::Hash[::String, untyped]
|
5
7
|
|
6
8
|
def self.version: () -> ::String
|
7
9
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libddwaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.24.1.0
|
4
|
+
version: 1.24.1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-08-15 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: ffi
|
@@ -72,7 +71,6 @@ licenses:
|
|
72
71
|
- BSD-3-Clause
|
73
72
|
metadata:
|
74
73
|
allowed_push_host: https://rubygems.org
|
75
|
-
post_install_message:
|
76
74
|
rdoc_options: []
|
77
75
|
require_paths:
|
78
76
|
- lib
|
@@ -87,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
85
|
- !ruby/object:Gem::Version
|
88
86
|
version: 2.0.0
|
89
87
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
91
|
-
signing_key:
|
88
|
+
rubygems_version: 3.6.2
|
92
89
|
specification_version: 4
|
93
90
|
summary: Datadog WAF
|
94
91
|
test_files: []
|