libddwaf 1.24.1.0.3-x86_64-darwin → 1.24.1.1.0-x86_64-darwin
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: ee26200dafea81311489c931a10c838daf9840f50d91412d5d2ec58f6a75dada
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5fcd99ca991d2cec3bfe2bdadcd01ebad588e1f67fd73ef16605fc13a6c52515
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fbb49cf0864138a2986eaa0f204fc7ae066b82c4d2ed43d7ed42e6b73c5de0e05bff2707999ea98b4b614c730dc66c6f9d1023fcdea984897994b6b247c3b708
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: aaf1716d8e4bb716846f23e1f847f47a8d0e54a2657a20820f7363c4876b816c8bfb4346773d0fe0f8550dc98d76640d36e84a4b7f5a9be051ea8b81eca269f0
         
     | 
    
        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: x86_64-darwin
         
     | 
| 
       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
         
     | 
| 
         @@ -69,7 +68,6 @@ licenses: 
     | 
|
| 
       69 
68 
     | 
    
         
             
            - BSD-3-Clause
         
     | 
| 
       70 
69 
     | 
    
         
             
            metadata:
         
     | 
| 
       71 
70 
     | 
    
         
             
              allowed_push_host: https://rubygems.org
         
     | 
| 
       72 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
       73 
71 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       74 
72 
     | 
    
         
             
            require_paths:
         
     | 
| 
       75 
73 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -84,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       84 
82 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       85 
83 
     | 
    
         
             
                  version: 2.0.0
         
     | 
| 
       86 
84 
     | 
    
         
             
            requirements: []
         
     | 
| 
       87 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
       88 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 85 
     | 
    
         
            +
            rubygems_version: 3.6.2
         
     | 
| 
       89 
86 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       90 
87 
     | 
    
         
             
            summary: Datadog WAF
         
     | 
| 
       91 
88 
     | 
    
         
             
            test_files: []
         
     |