libddwaf 1.25.1.0.1-x86_64-linux → 1.25.1.1.0-x86_64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b36ec60e121f929ccbef3adc22d81d5fafdb0b236ef79d0b028b0327eb2ea040
4
- data.tar.gz: 341d0723c2803f33b6fc5e1858e180412f07c1aedda3b83f10b66a9a5f0bbfa9
3
+ metadata.gz: 71671f701c7f58c826e83a62f0470a2b449e7d659cfd30fcaad92f52162b46c1
4
+ data.tar.gz: ee250d0784c98ea3f08d0ae963ce0f6b80f6e300ce1a214bc2c93b4ebe141328
5
5
  SHA512:
6
- metadata.gz: 6f3ce7eecf84e5d2c38b083813e44b90f9a1d31b22da2e2b08c1e2058fa8b542fc7c1e2cfbbce04ef2c9ab34b491eafe26e7f511ce472922a6a54fb2ac33137f
7
- data.tar.gz: 9feb93b60cc1724a071ae856a008007f8ae8c9bc5825084c371bc19d746346d6411c6e38ab19763b06f09815f22c04d4f222c9b27947a6191345d1fe37a7b633
6
+ metadata.gz: 03434db73b64a7709cd085ced0e3edffd1c12fd0c0afc04744e8bfc1d564cf6590c11e86eb8b3b045a3e27b1750ed473df2e2faf3b763660e915f46d27fb8266
7
+ data.tar.gz: f32ab29f00644c0d1f35d93bd6f44c7315a2ba0a097129d567aafee532a257d8c111fc5adcf859482a8c3e10271275af2d91d67e7f42eba59843b8957a9f013c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Unreleased
2
2
 
3
+ # 2025-09-24 v1.25.1.1.0
4
+
5
+ ## Changed
6
+
7
+ - Change coersion of the values in WAF rules to use `libddwaf` primitives
8
+
3
9
  # 2025-09-18 v1.25.1.0.1
4
10
 
5
11
  ## Fixed
@@ -7,9 +7,9 @@ module Datadog
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]
10
+ "events" => [], #: WAF::events
11
+ "actions" => {}, #: WAF::actions
12
+ "attributes" => {}, #: WAF::attributes
13
13
  "duration" => 0,
14
14
  "timeout" => false,
15
15
  "keep" => false
@@ -164,13 +164,13 @@ 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| #$ ::Array[WAF::output]
167
+ (0...obj[:nbEntries]).each.with_object([]) do |i, a| #$ ::Array[WAF::opaque]
168
168
  ptr = obj[:valueUnion][:array] + i * LibDDWAF::Object.size
169
169
  e = Converter.object_to_ruby(LibDDWAF::Object.new(ptr))
170
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::output]
173
+ (0...obj[:nbEntries]).each.with_object({}) do |i, h| #$ ::Hash[::String, WAF::opaque]
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]
@@ -58,7 +58,7 @@ module Datadog
58
58
  def add_or_update_config(config, path:)
59
59
  ensure_pointer_presence!
60
60
 
61
- config_obj = Converter.ruby_to_object(config)
61
+ config_obj = Converter.ruby_to_object(config, coerce: false)
62
62
  diagnostics_obj = LibDDWAF::Object.new
63
63
 
64
64
  LibDDWAF.ddwaf_builder_add_or_update_config(@builder_ptr, path, path.length, config_obj, diagnostics_obj)
@@ -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.1"
8
+ STRING = "#{BASE_STRING}.1.0"
9
9
  MINIMUM_RUBY_VERSION = "2.5"
10
10
  end
11
11
  end
@@ -4,12 +4,12 @@ module Datadog
4
4
  class Context
5
5
  @context_ptr: ::FFI::Pointer
6
6
 
7
- @retained: Array[top]
7
+ @retained: Array[untyped]
8
8
 
9
9
  EMPTY_RESULT: {
10
- "events" => ::Array[WAF::output],
11
- "actions" => ::Hash[::String, WAF::output],
12
- "attributes" => ::Hash[::String, WAF::output],
10
+ "events" => WAF::events,
11
+ "actions" => WAF::actions,
12
+ "attributes" => WAF::attributes,
13
13
  "duration" => ::Integer,
14
14
  "timeout" => bool,
15
15
  "keep" => bool
@@ -11,7 +11,7 @@ module Datadog
11
11
  ?coerce: bool?
12
12
  ) -> LibDDWAF::Object
13
13
 
14
- def self?.object_to_ruby: (LibDDWAF::Object obj) -> WAF::output
14
+ def self?.object_to_ruby: (LibDDWAF::Object obj) -> WAF::opaque
15
15
  end
16
16
  end
17
17
  end
@@ -11,9 +11,9 @@ module Datadog
11
11
  end
12
12
 
13
13
  class LibDDWAFError < Error
14
- attr_reader diagnostics: WAF::output
14
+ attr_reader diagnostics: WAF::opaque
15
15
 
16
- def initialize: (::String msg, ?diagnostics: WAF::output?) -> void
16
+ def initialize: (::String msg, ?diagnostics: WAF::opaque?) -> 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: (WAF::input config, path: ::String) -> WAF::output
13
+ def add_or_update_config: (WAF::input config, path: ::String) -> WAF::opaque
14
14
 
15
15
  def remove_config_at_path: (::String path) -> bool
16
16
 
@@ -2,16 +2,13 @@ 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
-
8
5
  @status: ::Symbol
9
6
 
10
- @events: list
7
+ @events: WAF::events
11
8
 
12
- @actions: map
9
+ @actions: WAF::actions
13
10
 
14
- @attributes: map
11
+ @attributes: WAF::attributes
15
12
 
16
13
  @duration: ::Integer
17
14
 
@@ -23,19 +20,19 @@ module Datadog
23
20
 
24
21
  attr_reader status: ::Symbol
25
22
 
26
- attr_reader events: list
23
+ attr_reader events: WAF::events
27
24
 
28
- attr_reader actions: map
25
+ attr_reader actions: WAF::actions
29
26
 
30
- attr_reader attributes: map
27
+ attr_reader attributes: WAF::attributes
31
28
 
32
29
  attr_reader duration: ::Integer
33
30
 
34
31
  def initialize: (
35
32
  status: ::Symbol,
36
- events: list,
37
- actions: map,
38
- attributes: map,
33
+ events: WAF::events,
34
+ actions: WAF::actions,
35
+ attributes: WAF::attributes,
39
36
  duration: ::Integer,
40
37
  timeout: bool,
41
38
  keep: bool
@@ -49,7 +46,7 @@ module Datadog
49
46
 
50
47
  def input_truncated?: () -> bool
51
48
 
52
- def to_h: () -> ::Hash[::Symbol, (::Symbol | WAF::output)]
49
+ def to_h: () -> ::Hash[::Symbol, (::Symbol | WAF::opaque)]
53
50
  end
54
51
  end
55
52
  end
@@ -2,8 +2,45 @@ module Datadog
2
2
  module AppSec
3
3
  module WAF
4
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]
6
5
  type known_addresses = ::Array[::String]
6
+ type result = {
7
+ "keep" => bool,
8
+ "events" => events,
9
+ "actions" => actions,
10
+ "attributes" => attributes,
11
+ "timeout" => bool,
12
+ # NOTE: Schema defines it as a `number`, but we alway get it as `Integer`
13
+ # That will be fixed in the libddwaf specs
14
+ "duration" => ::Integer
15
+ }
16
+ type events = ::Array[event]
17
+ type event = {"rule" => rule, "rule_matches" => ::Array[rule_match]}
18
+ type rule = {
19
+ "id" => ::String,
20
+ "name" => ::String,
21
+ "tags" => {
22
+ "type" => ::String,
23
+ # optional key
24
+ "category" => ::String?
25
+ },
26
+ # optional key
27
+ "on_match" => ::Array[::String]?
28
+ }
29
+ type rule_match = {
30
+ "operator" => ::String,
31
+ "operator_value" => ::String,
32
+ "parameters" => ::Array[rule_match_parameter]
33
+ }
34
+ type rule_match_parameter = {
35
+ "address" => ::String,
36
+ "key_path" => ::Array[::String | ::Integer],
37
+ "value" => ::String,
38
+ "highlight" => ::Array[::String]
39
+ }
40
+ type actions = ::Hash[::String, action]
41
+ type action = ::Hash[::String, ::String]
42
+ type attributes = ::Hash[::String, opaque]
43
+ type opaque = nil | bool | ::String | ::Integer | ::Float | ::Array[opaque] | ::Hash[::String, opaque]
7
44
 
8
45
  self.@logger: ::Logger
9
46
 
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.1
4
+ version: 1.25.1.1.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-18 00:00:00.000000000 Z
11
+ date: 2025-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi