libddwaf 1.24.1.2.1 → 1.25.1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '029b3d9c81bc6161f7080edb546d4de3820769540747788f766638dd28472776'
4
- data.tar.gz: 336fa61a91724299d961cbb03f12347cf51c6cf4f72a05e72f9368e077045c60
3
+ metadata.gz: 3bc1b4115cc939368bc3f3416ebf7f8436b3226f0c9e95f042b6a75e3dbb61db
4
+ data.tar.gz: 9b0259689d75ab36ac72a5c8c720eecea3786b830c2a6bc8eb472ee28f0310d6
5
5
  SHA512:
6
- metadata.gz: a658fc7175a4e87599844a60712284743d4a765d700c3584f9a84acb15f2f230613085be8b7a563090fdffe150640cf5af18d547e08880d68b99bf93259f5e95
7
- data.tar.gz: a7616a7818f46cdb402fe0e7b111b927e990e4f5e274a191877685070facf0df85ff91f292b7a88b75272905a7069f7b2e285c17099e8fac0911d3b192baf2c8
6
+ metadata.gz: 55d7175ad3178b8b2866d2f95bafccfda1d6e0c45ee43f30a6efabc15e58744ceaec7ea92837dfba69cc3fe46af7fd6e17ed2446fc49cfe07282f3ff57a810ba
7
+ data.tar.gz: 2bd16d83de99d38b2ebbb12e1235c1f2121fd54fe9b33962d43cab73a1b5012e1f1d1fb4de5d322599cfd5fe530269374cb6bf0f6a4466a75f53deae4f084129
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Unreleased
2
2
 
3
+ # 2025-09-16 v1.25.1.0.0
4
+
5
+ ## Added
6
+
7
+ - Add `Result#keep?` method
8
+
9
+ ## Changed
10
+
11
+ - Change `LibDDWAF::Object#input_truncated?` to `LibDDWAF::Object#truncated?` method
12
+ - Change `LibDDWAF::Object#mark_as_input_truncated?` to `LibDDWAF::Object#mark_truncated?` method
13
+ - Change `Result#timeout` to `Result#timeout?` method
14
+ - Change `Result#derivatives` to `Result#attributes` method
15
+ - Change `Result#total_runtime` to `Result#duration` method
16
+
3
17
  # 2025-09-15 v1.24.1.2.1
4
18
 
5
19
  ## Fixed
@@ -69,18 +69,24 @@ module Datadog
69
69
  raise ConversionError, "Could not convert ephemeral data: #{ephemeral_data.inspect}"
70
70
  end
71
71
 
72
- result_obj = LibDDWAF::Result.new
72
+ result_obj = LibDDWAF::Object.new
73
73
  raise LibDDWAFError, "Could not create result object" if result_obj.null?
74
74
 
75
75
  code = LibDDWAF.ddwaf_run(@context_ptr, persistent_data_obj, ephemeral_data_obj, result_obj, timeout)
76
+ result = Converter.object_to_ruby(result_obj) #: ::Hash[::String, WAF::data]
77
+
78
+ if result.nil?
79
+ raise ConversionError, "Could not convert result into object: #{code}"
80
+ end
76
81
 
77
82
  result = Result.new(
78
- RESULT_CODE[code],
79
- Converter.object_to_ruby(result_obj[:events]),
80
- result_obj[:total_runtime],
81
- result_obj[:timeout],
82
- Converter.object_to_ruby(result_obj[:actions]),
83
- Converter.object_to_ruby(result_obj[:derivatives])
83
+ status: RESULT_CODE[code],
84
+ events: result["events"],
85
+ actions: result["actions"],
86
+ attributes: result["attributes"],
87
+ duration: result["duration"], #: ::Integer
88
+ timeout: result["timeout"], #: bool
89
+ keep: result["keep"] #: bool
84
90
  )
85
91
 
86
92
  if persistent_data_obj.truncated? || ephemeral_data_obj.truncated?
@@ -89,7 +95,7 @@ module Datadog
89
95
 
90
96
  result
91
97
  ensure
92
- LibDDWAF.ddwaf_result_free(result_obj) if result_obj
98
+ LibDDWAF.ddwaf_object_free(result_obj) if result_obj
93
99
  LibDDWAF.ddwaf_object_free(ephemeral_data_obj) if ephemeral_data_obj
94
100
  end
95
101
 
@@ -170,7 +170,7 @@ module Datadog
170
170
  a << e # steep:ignore
171
171
  end
172
172
  when :ddwaf_obj_map
173
- (0...obj[:nbEntries]).each.with_object({}) do |i, h|
173
+ (0...obj[:nbEntries]).each.with_object({}) do |i, h| #$ ::Hash[::String, WAF::data]
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]
@@ -253,21 +253,9 @@ module Datadog
253
253
  attach_function :ddwaf_context_init, [:ddwaf_handle], :ddwaf_context
254
254
  attach_function :ddwaf_context_destroy, [:ddwaf_context], :void
255
255
 
256
- # Ruby representation of ddwaf_result
257
- # See https://github.com/DataDog/libddwaf/blob/10e3a1dfc7bc9bb8ab11a09a9f8b6b339eaf3271/include/ddwaf.h#L154-L173
258
- class Result < ::FFI::Struct
259
- layout :timeout, :bool,
260
- :events, Object,
261
- :actions, Object,
262
- :derivatives, Object,
263
- :total_runtime, :uint64
264
- end
265
-
266
- typedef Result.by_ref, :ddwaf_result
267
256
  typedef :uint64, :timeout_us
268
257
 
269
- attach_function :ddwaf_run, [:ddwaf_context, :ddwaf_object, :ddwaf_object, :ddwaf_result, :timeout_us], :ddwaf_ret_code, blocking: true
270
- attach_function :ddwaf_result_free, [:ddwaf_result], :void
258
+ attach_function :ddwaf_run, [:ddwaf_context, :ddwaf_object, :ddwaf_object, :ddwaf_object, :timeout_us], :ddwaf_ret_code, blocking: true
271
259
 
272
260
  # logging
273
261
 
@@ -4,17 +4,18 @@ module Datadog
4
4
  module AppSec
5
5
  module WAF
6
6
  # Ruby representation of the ddwaf_result of a libddwaf run.
7
- # See https://github.com/DataDog/libddwaf/blob/10e3a1dfc7bc9bb8ab11a09a9f8b6b339eaf3271/include/ddwaf.h#L159-L173
7
+ # See https://github.com/DataDog/libddwaf/blob/8dbee187ff74a0aa25e1bcbdde51677f77930e1b/include/ddwaf.h#L277-L290
8
8
  class Result
9
- attr_reader :status, :events, :total_runtime, :timeout, :actions, :derivatives
9
+ attr_reader :status, :events, :actions, :attributes, :duration
10
10
 
11
- def initialize(status, events, total_runtime, timeout, actions, derivatives)
11
+ def initialize(status:, events:, actions:, attributes:, duration:, timeout:, keep:)
12
12
  @status = status
13
13
  @events = events
14
- @total_runtime = total_runtime
15
- @timeout = timeout
16
14
  @actions = actions
17
- @derivatives = derivatives
15
+ @attributes = attributes
16
+ @duration = duration
17
+ @timeout = timeout
18
+ @keep = keep
18
19
  @input_truncated = false
19
20
  end
20
21
 
@@ -22,6 +23,14 @@ module Datadog
22
23
  @input_truncated = true
23
24
  end
24
25
 
26
+ def timeout?
27
+ @timeout
28
+ end
29
+
30
+ def keep?
31
+ @keep
32
+ end
33
+
25
34
  def input_truncated?
26
35
  @input_truncated
27
36
  end
@@ -30,10 +39,12 @@ module Datadog
30
39
  {
31
40
  status: @status,
32
41
  events: @events,
33
- total_runtime: @total_runtime,
34
- timeout: @timeout,
35
42
  actions: @actions,
36
- derivatives: @derivatives
43
+ attributes: @attributes,
44
+ duration: @duration,
45
+ timeout: @timeout,
46
+ keep: @keep,
47
+ input_truncated: @input_truncated
37
48
  }
38
49
  end
39
50
  end
@@ -2,10 +2,10 @@ module Datadog
2
2
  module AppSec
3
3
  module WAF
4
4
  module VERSION
5
- BASE_STRING = "1.24.1"
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}.2.1"
8
+ STRING = "#{BASE_STRING}.0.0"
9
9
  MINIMUM_RUBY_VERSION = "2.5"
10
10
  end
11
11
  end
@@ -2,9 +2,9 @@ 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?, ?top_obj: LibDDWAF::Object?, ?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
- def self.object_to_ruby: (LibDDWAF::Object obj) -> WAF::data
7
+ def self?.object_to_ruby: (LibDDWAF::Object obj) -> WAF::data
8
8
  end
9
9
  end
10
10
  end
@@ -139,11 +139,7 @@ module Datadog
139
139
  def self.ddwaf_context_init: (::FFI::Pointer) -> ::FFI::Pointer
140
140
  def self.ddwaf_context_destroy: (::FFI::Pointer) -> void
141
141
 
142
- class Result < ::FFI::Struct[::FFI::AbstractMemory, untyped]
143
- end
144
-
145
- def self.ddwaf_run: (::FFI::Pointer, Object, Object, Result, ::Integer) -> ::Symbol
146
- def self.ddwaf_result_free: (Result) -> void
142
+ def self.ddwaf_run: (::FFI::Pointer, Object, Object, Object, ::Integer) -> ::Symbol
147
143
 
148
144
  # logging
149
145
 
@@ -6,13 +6,15 @@ module Datadog
6
6
 
7
7
  @events: WAF::data
8
8
 
9
- @total_runtime: ::Float
9
+ @actions: WAF::data
10
10
 
11
- @timeout: bool
11
+ @attributes: WAF::data
12
12
 
13
- @actions: WAF::data
13
+ @duration: ::Integer
14
14
 
15
- @derivatives: WAF::data
15
+ @timeout: bool
16
+
17
+ @keep: bool
16
18
 
17
19
  @input_truncated: bool
18
20
 
@@ -20,19 +22,31 @@ module Datadog
20
22
 
21
23
  attr_reader events: WAF::data
22
24
 
23
- attr_reader total_runtime: ::Float
24
-
25
- attr_reader timeout: bool
26
-
27
25
  attr_reader actions: WAF::data
28
26
 
29
- attr_reader derivatives: WAF::data
27
+ attr_reader attributes: WAF::data
28
+
29
+ attr_reader duration: ::Integer
30
30
 
31
- def initialize: (::Symbol status, WAF::data events, ::Float total_runtime, bool timeout, WAF::data actions, WAF::data derivatives) -> void
31
+ def initialize: (
32
+ status: ::Symbol,
33
+ events: WAF::data,
34
+ actions: WAF::data,
35
+ attributes: WAF::data,
36
+ duration: ::Integer,
37
+ timeout: bool,
38
+ keep: bool
39
+ ) -> void
32
40
 
33
41
  def mark_input_truncated!: () -> bool
34
42
 
43
+ def timeout?: () -> bool
44
+
45
+ def keep?: () -> bool
46
+
35
47
  def input_truncated?: () -> bool
48
+
49
+ def to_h: () -> ::Hash[::Symbol, WAF::data]
36
50
  end
37
51
  end
38
52
  end
@@ -1,18 +1,18 @@
1
1
  module Datadog
2
2
  module AppSec
3
3
  module WAF
4
- type data = String | Symbol | Integer | Float | TrueClass | FalseClass | Array[data] | Hash[(String | Symbol | nil), data] | nil
4
+ type data = nil | bool | ::String | ::Symbol | ::Integer | ::Float | ::Array[data] | ::Hash[(::String | ::Symbol | nil), data]
5
5
  type known_addresses = ::Array[::String]
6
6
  type diagnostics = ::Hash[::String, untyped]
7
7
 
8
- def self.version: () -> ::String
8
+ def self?.version: () -> ::String
9
9
 
10
10
  self.@logger: ::Logger
11
11
  self.@log_callback: LibDDWAF::ddwaf_log_cb
12
12
 
13
- def self.log_callback: (LibDDWAF::ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
14
- def self.logger: () -> ::Logger
15
- def self.logger=: (::Logger logger) -> void
13
+ def self?.log_callback: (LibDDWAF::ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
14
+ def self?.logger: () -> ::Logger
15
+ def self?.logger=: (::Logger logger) -> void
16
16
  end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libddwaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.24.1.2.1
4
+ version: 1.25.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-09-15 00:00:00.000000000 Z
11
+ date: 2025-09-16 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: ffi
@@ -60,10 +61,10 @@ files:
60
61
  - sig/datadog/appsec/waf/result.rbs
61
62
  - sig/datadog/appsec/waf/version.rbs
62
63
  - sig/libddwaf.rbs
63
- - vendor/libddwaf/libddwaf-1.24.1-darwin-arm64/lib/libddwaf.dylib
64
- - vendor/libddwaf/libddwaf-1.24.1-darwin-x86_64/lib/libddwaf.dylib
65
- - vendor/libddwaf/libddwaf-1.24.1-linux-aarch64/lib/libddwaf.so
66
- - vendor/libddwaf/libddwaf-1.24.1-linux-x86_64/lib/libddwaf.so
64
+ - vendor/libddwaf/libddwaf-1.25.1-darwin-arm64/lib/libddwaf.dylib
65
+ - vendor/libddwaf/libddwaf-1.25.1-darwin-x86_64/lib/libddwaf.dylib
66
+ - vendor/libddwaf/libddwaf-1.25.1-linux-aarch64/lib/libddwaf.so
67
+ - vendor/libddwaf/libddwaf-1.25.1-linux-x86_64/lib/libddwaf.so
67
68
  - vendor/rbs/gem/0/gem.rbs
68
69
  - vendor/rbs/jruby/0/jruby.rbs
69
70
  homepage: https://github.com/DataDog/libddwaf-rb
@@ -71,6 +72,7 @@ licenses:
71
72
  - BSD-3-Clause
72
73
  metadata:
73
74
  allowed_push_host: https://rubygems.org
75
+ post_install_message:
74
76
  rdoc_options: []
75
77
  require_paths:
76
78
  - lib
@@ -85,7 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
87
  - !ruby/object:Gem::Version
86
88
  version: 2.0.0
87
89
  requirements: []
88
- rubygems_version: 3.6.2
90
+ rubygems_version: 3.5.21
91
+ signing_key:
89
92
  specification_version: 4
90
93
  summary: Datadog WAF
91
94
  test_files: []