libddwaf 1.25.1.0.0-aarch64-linux → 1.25.1.0.1-aarch64-linux
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 +6 -0
- data/lib/datadog/appsec/waf/context.rb +20 -7
- data/lib/datadog/appsec/waf/converter.rb +4 -4
- data/lib/datadog/appsec/waf/result.rb +4 -3
- data/lib/datadog/appsec/waf/version.rb +1 -1
- data/sig/datadog/appsec/waf/context.rbs +14 -3
- data/sig/datadog/appsec/waf/converter.rbs +9 -2
- data/sig/datadog/appsec/waf/errors.rbs +2 -2
- data/sig/datadog/appsec/waf/handle_builder.rbs +1 -1
- data/sig/datadog/appsec/waf/lib_ddwaf.rbs +2 -0
- data/sig/datadog/appsec/waf/result.rbs +13 -10
- data/sig/datadog/appsec/waf.rbs +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661702c551cfbddbf8b9dd55d24a8572a685eda0a1c98d5fe78b47018b1dcd6e
|
4
|
+
data.tar.gz: f7c9eb3d05dde8b758570478c24b4a5af04a41d98be6fb060dff4fa055e0fec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b58353150f1b9957bb773741ea1bf1a0513a332718b6b45600d76c1d2064e4e558f43b3a58a053389459409c1d2e71aeb79b44a0fb0469167afa8f69178ae7a9
|
7
|
+
data.tar.gz: 9f0673a5e2ab110f87e5173a0e4375008dd756d1aca2874ca32a9aa6a60f8da3653273b79a91f07b14e91e906f8740cacff69559814dbcb8b5ac1b4bc06e1375
|
data/CHANGELOG.md
CHANGED
@@ -6,7 +6,16 @@ module Datadog
|
|
6
6
|
# Ruby representation of the ddwaf_context in libddwaf
|
7
7
|
# See https://github.com/DataDog/libddwaf/blob/10e3a1dfc7bc9bb8ab11a09a9f8b6b339eaf3271/BINDING_IMPL_NOTES.md?plain=1#L125-L158
|
8
8
|
class Context
|
9
|
-
|
9
|
+
EMPTY_RESULT = {
|
10
|
+
"events" => [], #: ::Array[WAF::output]
|
11
|
+
"actions" => {}, #: ::Hash[::String, WAF::output]
|
12
|
+
"attributes" => {}, #: ::Hash[::String, WAF::output]
|
13
|
+
"duration" => 0,
|
14
|
+
"timeout" => false,
|
15
|
+
"keep" => false
|
16
|
+
}.freeze
|
17
|
+
SUCCESS_RESULT_CODES = %i[ddwaf_ok ddwaf_match].freeze
|
18
|
+
RESULT_CODE_TO_STATUS = {
|
10
19
|
ddwaf_ok: :ok,
|
11
20
|
ddwaf_match: :match,
|
12
21
|
ddwaf_err_internal: :err_internal,
|
@@ -73,20 +82,24 @@ module Datadog
|
|
73
82
|
raise LibDDWAFError, "Could not create result object" if result_obj.null?
|
74
83
|
|
75
84
|
code = LibDDWAF.ddwaf_run(@context_ptr, persistent_data_obj, ephemeral_data_obj, result_obj, timeout)
|
76
|
-
result = Converter.object_to_ruby(result_obj)
|
85
|
+
result = Converter.object_to_ruby(result_obj)
|
77
86
|
|
78
|
-
|
87
|
+
# NOTE: In case of the error, `libddwaf` will not "fill" the result
|
88
|
+
# object, so it will be empty and the conversion of it will return
|
89
|
+
# `nil`, but that is not a conversion issue.
|
90
|
+
if SUCCESS_RESULT_CODES.include?(code) && result.nil?
|
79
91
|
raise ConversionError, "Could not convert result into object: #{code}"
|
80
92
|
end
|
81
93
|
|
94
|
+
result ||= EMPTY_RESULT
|
82
95
|
result = Result.new(
|
83
|
-
status:
|
96
|
+
status: RESULT_CODE_TO_STATUS[code],
|
84
97
|
events: result["events"],
|
85
98
|
actions: result["actions"],
|
86
99
|
attributes: result["attributes"],
|
87
|
-
duration: result["duration"],
|
88
|
-
timeout: result["timeout"],
|
89
|
-
keep: result["keep"]
|
100
|
+
duration: result["duration"],
|
101
|
+
timeout: result["timeout"],
|
102
|
+
keep: result["keep"]
|
90
103
|
)
|
91
104
|
|
92
105
|
if persistent_data_obj.truncated? || ephemeral_data_obj.truncated?
|
@@ -164,19 +164,19 @@ module Datadog
|
|
164
164
|
when :ddwaf_obj_float
|
165
165
|
obj[:valueUnion][:f64]
|
166
166
|
when :ddwaf_obj_array
|
167
|
-
(0...obj[:nbEntries]).each.with_object([]) do |i, a|
|
167
|
+
(0...obj[:nbEntries]).each.with_object([]) do |i, a| #$ ::Array[WAF::output]
|
168
168
|
ptr = obj[:valueUnion][:array] + i * LibDDWAF::Object.size
|
169
169
|
e = Converter.object_to_ruby(LibDDWAF::Object.new(ptr))
|
170
|
-
a << e
|
170
|
+
a << e
|
171
171
|
end
|
172
172
|
when :ddwaf_obj_map
|
173
|
-
(0...obj[:nbEntries]).each.with_object({}) do |i, h| #$ ::Hash[::String, WAF::
|
173
|
+
(0...obj[:nbEntries]).each.with_object({}) do |i, h| #$ ::Hash[::String, WAF::output]
|
174
174
|
ptr = obj[:valueUnion][:array] + i * Datadog::AppSec::WAF::LibDDWAF::Object.size
|
175
175
|
o = Datadog::AppSec::WAF::LibDDWAF::Object.new(ptr)
|
176
176
|
l = o[:parameterNameLength]
|
177
177
|
k = o[:parameterName].read_bytes(l)
|
178
178
|
v = Converter.object_to_ruby(LibDDWAF::Object.new(ptr))
|
179
|
-
h[k] = v
|
179
|
+
h[k] = v
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
@@ -14,8 +14,9 @@ module Datadog
|
|
14
14
|
@actions = actions
|
15
15
|
@attributes = attributes
|
16
16
|
@duration = duration
|
17
|
-
|
18
|
-
@keep = keep
|
17
|
+
|
18
|
+
@keep = !!keep
|
19
|
+
@timeout = !!timeout
|
19
20
|
@input_truncated = false
|
20
21
|
end
|
21
22
|
|
@@ -42,8 +43,8 @@ module Datadog
|
|
42
43
|
actions: @actions,
|
43
44
|
attributes: @attributes,
|
44
45
|
duration: @duration,
|
45
|
-
timeout: @timeout,
|
46
46
|
keep: @keep,
|
47
|
+
timeout: @timeout,
|
47
48
|
input_truncated: @input_truncated
|
48
49
|
}
|
49
50
|
end
|
@@ -5,7 +5,7 @@ module Datadog
|
|
5
5
|
BASE_STRING = "1.25.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}.0.1"
|
9
9
|
MINIMUM_RUBY_VERSION = "2.5"
|
10
10
|
end
|
11
11
|
end
|
@@ -4,15 +4,26 @@ module Datadog
|
|
4
4
|
class Context
|
5
5
|
@context_ptr: ::FFI::Pointer
|
6
6
|
|
7
|
-
@retained: Array[
|
7
|
+
@retained: Array[top]
|
8
8
|
|
9
|
-
|
9
|
+
EMPTY_RESULT: {
|
10
|
+
"events" => ::Array[WAF::output],
|
11
|
+
"actions" => ::Hash[::String, WAF::output],
|
12
|
+
"attributes" => ::Hash[::String, WAF::output],
|
13
|
+
"duration" => ::Integer,
|
14
|
+
"timeout" => bool,
|
15
|
+
"keep" => bool
|
16
|
+
}
|
17
|
+
|
18
|
+
SUCCESS_RESULT_CODES: ::Array[::Symbol]
|
19
|
+
|
20
|
+
RESULT_CODE_TO_STATUS: ::Hash[::Symbol, ::Symbol]
|
10
21
|
|
11
22
|
def initialize: (::FFI::Pointer context_ptr) -> void
|
12
23
|
|
13
24
|
def finalize!: () -> void
|
14
25
|
|
15
|
-
def run: (WAF::
|
26
|
+
def run: (WAF::input persistent_data, WAF::input ephemeral_data, ?::Integer timeout) -> Result
|
16
27
|
|
17
28
|
private
|
18
29
|
|
@@ -2,9 +2,16 @@ module Datadog
|
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
4
|
module Converter
|
5
|
-
def self?.ruby_to_object: (
|
5
|
+
def self?.ruby_to_object: (
|
6
|
+
top val,
|
7
|
+
?max_container_size: ::Integer?,
|
8
|
+
?max_container_depth: ::Integer?,
|
9
|
+
?max_string_length: ::Integer?,
|
10
|
+
?top_obj: LibDDWAF::Object?,
|
11
|
+
?coerce: bool?
|
12
|
+
) -> LibDDWAF::Object
|
6
13
|
|
7
|
-
def self?.object_to_ruby: (LibDDWAF::Object obj) -> WAF::
|
14
|
+
def self?.object_to_ruby: (LibDDWAF::Object obj) -> WAF::output
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
@@ -11,9 +11,9 @@ module Datadog
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class LibDDWAFError < Error
|
14
|
-
attr_reader diagnostics: WAF::
|
14
|
+
attr_reader diagnostics: WAF::output
|
15
15
|
|
16
|
-
def initialize: (::String msg, ?diagnostics: WAF::
|
16
|
+
def initialize: (::String msg, ?diagnostics: WAF::output?) -> void
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -10,7 +10,7 @@ module Datadog
|
|
10
10
|
|
11
11
|
def build_handle: () -> Handle
|
12
12
|
|
13
|
-
def add_or_update_config: (
|
13
|
+
def add_or_update_config: (WAF::input config, path: ::String) -> WAF::output
|
14
14
|
|
15
15
|
def remove_config_at_path: (::String path) -> bool
|
16
16
|
|
@@ -2,13 +2,16 @@ module Datadog
|
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
4
|
class Result
|
5
|
+
type list = ::Array[WAF::output]
|
6
|
+
type map = ::Hash[::String, WAF::output]
|
7
|
+
|
5
8
|
@status: ::Symbol
|
6
9
|
|
7
|
-
@events:
|
10
|
+
@events: list
|
8
11
|
|
9
|
-
@actions:
|
12
|
+
@actions: map
|
10
13
|
|
11
|
-
@attributes:
|
14
|
+
@attributes: map
|
12
15
|
|
13
16
|
@duration: ::Integer
|
14
17
|
|
@@ -20,19 +23,19 @@ module Datadog
|
|
20
23
|
|
21
24
|
attr_reader status: ::Symbol
|
22
25
|
|
23
|
-
attr_reader events:
|
26
|
+
attr_reader events: list
|
24
27
|
|
25
|
-
attr_reader actions:
|
28
|
+
attr_reader actions: map
|
26
29
|
|
27
|
-
attr_reader attributes:
|
30
|
+
attr_reader attributes: map
|
28
31
|
|
29
32
|
attr_reader duration: ::Integer
|
30
33
|
|
31
34
|
def initialize: (
|
32
35
|
status: ::Symbol,
|
33
|
-
events:
|
34
|
-
actions:
|
35
|
-
attributes:
|
36
|
+
events: list,
|
37
|
+
actions: map,
|
38
|
+
attributes: map,
|
36
39
|
duration: ::Integer,
|
37
40
|
timeout: bool,
|
38
41
|
keep: bool
|
@@ -46,7 +49,7 @@ module Datadog
|
|
46
49
|
|
47
50
|
def input_truncated?: () -> bool
|
48
51
|
|
49
|
-
def to_h: () -> ::Hash[::Symbol, WAF::
|
52
|
+
def to_h: () -> ::Hash[::Symbol, (::Symbol | WAF::output)]
|
50
53
|
end
|
51
54
|
end
|
52
55
|
end
|
data/sig/datadog/appsec/waf.rbs
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
module Datadog
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
|
-
type
|
4
|
+
type input = nil | bool | ::String | ::Symbol | ::Integer | ::Float | ::Array[input] | ::Hash[input, input]
|
5
|
+
type output = nil | bool | ::String | ::Integer | ::Float | ::Array[output] | ::Hash[::String, output]
|
5
6
|
type known_addresses = ::Array[::String]
|
6
|
-
type diagnostics = ::Hash[::String, untyped]
|
7
|
-
|
8
|
-
def self?.version: () -> ::String
|
9
7
|
|
10
8
|
self.@logger: ::Logger
|
9
|
+
|
11
10
|
self.@log_callback: LibDDWAF::ddwaf_log_cb
|
12
11
|
|
12
|
+
def self?.version: () -> ::String
|
13
|
+
|
13
14
|
def self?.log_callback: (LibDDWAF::ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
|
15
|
+
|
14
16
|
def self?.logger: () -> ::Logger
|
17
|
+
|
15
18
|
def self?.logger=: (::Logger logger) -> void
|
16
19
|
end
|
17
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libddwaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.25.1.0.
|
4
|
+
version: 1.25.1.0.1
|
5
5
|
platform: aarch64-linux
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|