libddwaf 1.0.12.0.0.beta1-x86_64-linux → 1.0.14.1.0.beta2-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: dab12980ca6c95ec58d821288140619a2d17f84b433fb497ab796ec0ef04f021
4
- data.tar.gz: e14881741eddcb4a472c8ce8642158b5ff0efaa37e9b74dd986f2473a467d301
3
+ metadata.gz: 8616a45002caed30fa3d02d1c4c7ae83e27fb82b980e34da9facc6d6c42afed0
4
+ data.tar.gz: 33aa16f33c3d58bf3f12c0ed019ee4d51cd8d2a6c6802309b9f112ae81c5e2de
5
5
  SHA512:
6
- metadata.gz: 8c3193bbaa560bece066b05fb549c1715b0a15305e298baf00fb1cf916d1c5324fc4c9d68e1c20d3361013eab0538d99754c747eac2262cd6ce5dba7120eb485
7
- data.tar.gz: d9f44ab78c539a7cd3a33d9e5ab04f26b3146f7adbdd81316cc7c2653a8a1dc2f50db53c0817be2d079eb41724243f1fe959fb3ed0ae38fe0d48f943a9d85cbe
6
+ metadata.gz: 31b36b0cc7e029d27d763387fcbe70dabd4ae1ed949f05d8c56e6fff8be3db8d8d0dcfbeaf7e369cf078b33c28ae66a99a1069ee0b0bf8bd03e9fa437f9ac725
7
+ data.tar.gz: 28acdd24ab5ebbc49234c3647f8c6d5e7080635082064b181809c91419fccc4ad1d6d8c47b815175bf589013edd5e836e51d5d0287a3264ecf8f456c855f4059
@@ -2,10 +2,9 @@ module Datadog
2
2
  module Security
3
3
  module WAF
4
4
  module VERSION
5
- BASE_STRING = '1.0.12'
6
- STRING = "#{BASE_STRING}.0.0.beta1"
5
+ BASE_STRING = '1.0.14'
6
+ STRING = "#{BASE_STRING}.1.0.beta2"
7
7
  MINIMUM_RUBY_VERSION = '2.1'
8
- MAXIMUM_RUBY_VERSION = '3.1'
9
8
  end
10
9
  end
11
10
  end
@@ -15,10 +15,10 @@ module Datadog
15
15
  os_name = java.lang.System.get_property('os.name')
16
16
 
17
17
  os = case os_name
18
- when /linux/i then 'linux'
19
- when /mac/i then 'darwin'
20
- else raise Error, "unsupported JRuby os.name: #{os_name.inspect}"
21
- end
18
+ when /linux/i then 'linux'
19
+ when /mac/i then 'darwin'
20
+ else raise Error, "unsupported JRuby os.name: #{os_name.inspect}"
21
+ end
22
22
 
23
23
  return os
24
24
  end
@@ -55,8 +55,8 @@ module Datadog
55
55
 
56
56
  class Version < ::FFI::Struct
57
57
  layout :major, :uint16,
58
- :minor, :uint16,
59
- :patch, :uint16
58
+ :minor, :uint16,
59
+ :patch, :uint16
60
60
  end
61
61
 
62
62
  typedef Version.by_ref, :ddwaf_version
@@ -76,17 +76,17 @@ module Datadog
76
76
 
77
77
  class ObjectValueUnion < ::FFI::Union
78
78
  layout :stringValue, :charptr,
79
- :uintValue, :uint64,
80
- :intValue, :int64,
81
- :array, :pointer
79
+ :uintValue, :uint64,
80
+ :intValue, :int64,
81
+ :array, :pointer
82
82
  end
83
83
 
84
84
  class Object < ::FFI::Struct
85
85
  layout :parameterName, :charptr,
86
- :parameterNameLength, :uint64,
87
- :valueUnion, ObjectValueUnion,
88
- :nbEntries, :uint64,
89
- :type, DDWAF_OBJ_TYPE
86
+ :parameterNameLength, :uint64,
87
+ :valueUnion, ObjectValueUnion,
88
+ :nbEntries, :uint64,
89
+ :type, DDWAF_OBJ_TYPE
90
90
  end
91
91
 
92
92
  typedef Object.by_ref, :ddwaf_object
@@ -118,8 +118,8 @@ module Datadog
118
118
 
119
119
  class Config < ::FFI::Struct
120
120
  layout :maxArrayLength, :uint64,
121
- :maxMapDepth, :uint64,
122
- :maxTimeStore, :uint64
121
+ :maxMapDepth, :uint64,
122
+ :maxTimeStore, :uint64
123
123
  end
124
124
 
125
125
  typedef Config.by_ref, :ddwaf_config
@@ -127,6 +127,8 @@ module Datadog
127
127
  attach_function :ddwaf_init, [:ddwaf_rule, :ddwaf_config], :ddwaf_handle
128
128
  attach_function :ddwaf_destroy, [:ddwaf_handle], :void
129
129
 
130
+ attach_function :ddwaf_required_addresses, [:ddwaf_handle, :pointer], :pointer
131
+
130
132
  # running
131
133
 
132
134
  typedef :pointer, :ddwaf_context
@@ -136,7 +138,6 @@ module Datadog
136
138
  attach_function :ddwaf_context_init, [:ddwaf_handle, :ddwaf_object_free_fn], :ddwaf_context
137
139
  attach_function :ddwaf_context_destroy, [:ddwaf_context], :void
138
140
 
139
-
140
141
  DDWAF_RET_CODE = enum :ddwaf_err_internal, -4,
141
142
  :ddwaf_err_invalid_object, -3,
142
143
  :ddwaf_err_invalid_argument, -2,
@@ -147,9 +148,9 @@ module Datadog
147
148
 
148
149
  class Result < ::FFI::Struct
149
150
  layout :action, DDWAF_RET_CODE,
150
- :data, :string,
151
- :perfData, :string,
152
- :perfTotalRuntime, :uint32 # in us
151
+ :data, :string,
152
+ :perfData, :string,
153
+ :perfTotalRuntime, :uint32 # in us
153
154
  end
154
155
 
155
156
  typedef Result.by_ref, :ddwaf_result
@@ -161,11 +162,11 @@ module Datadog
161
162
  # logging
162
163
 
163
164
  DDWAF_LOG_LEVEL = enum :ddwaf_log_trace,
164
- :ddwaf_log_debug,
165
- :ddwaf_log_info,
166
- :ddwaf_log_warn,
167
- :ddwaf_log_error,
168
- :ddwaf_log_off
165
+ :ddwaf_log_debug,
166
+ :ddwaf_log_info,
167
+ :ddwaf_log_warn,
168
+ :ddwaf_log_error,
169
+ :ddwaf_log_off
169
170
 
170
171
  callback :ddwaf_log_cb, [DDWAF_LOG_LEVEL, :string, :string, :uint, :charptr, :uint64], :void
171
172
 
@@ -351,11 +352,16 @@ module Datadog
351
352
  fail LibDDWAF::Error, 'Could not create context'
352
353
  end
353
354
 
354
- ObjectSpace.define_finalizer(self, Context.finalizer(context_obj))
355
+ @input_objs = []
356
+
357
+ ObjectSpace.define_finalizer(self, Context.finalizer(context_obj, @input_objs))
355
358
  end
356
359
 
357
- def self.finalizer(context_obj)
360
+ def self.finalizer(context_obj, input_objs)
358
361
  proc do |object_id|
362
+ input_objs.each do |input_obj|
363
+ Datadog::Security::WAF::LibDDWAF.ddwaf_object_free(input_obj)
364
+ end
359
365
  Datadog::Security::WAF::LibDDWAF.ddwaf_context_destroy(context_obj)
360
366
  end
361
367
  end
@@ -382,6 +388,9 @@ module Datadog
382
388
  fail LibDDWAF::Error, "Could not create result object"
383
389
  end
384
390
 
391
+ # retain C objects in memory for subsequent calls to run
392
+ @input_objs << input_obj
393
+
385
394
  code = Datadog::Security::WAF::LibDDWAF.ddwaf_run(@context_obj, input_obj, result_obj, timeout)
386
395
 
387
396
  result = Result.new(
@@ -393,7 +402,6 @@ module Datadog
393
402
 
394
403
  [ACTION_MAP_OUT[code], result]
395
404
  ensure
396
- Datadog::Security::WAF::LibDDWAF.ddwaf_object_free(input_obj) if input_obj
397
405
  Datadog::Security::WAF::LibDDWAF.ddwaf_result_free(result_obj) if result_obj
398
406
  end
399
407
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libddwaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12.0.0.beta1
4
+ version: 1.0.14.1.0.beta2
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: 2021-10-13 00:00:00.000000000 Z
11
+ date: 2022-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.0'
27
27
  description: 'libddwaf packages a WAF implementation in C++, exposed to Ruby
28
28
 
29
29
  '
@@ -41,8 +41,8 @@ files:
41
41
  - lib/datadog/security/waf.rb
42
42
  - lib/datadog/security/waf/version.rb
43
43
  - lib/libddwaf.rb
44
- - vendor/libddwaf/libddwaf-1.0.12-linux-x86_64/include/ddwaf.h
45
- - vendor/libddwaf/libddwaf-1.0.12-linux-x86_64/lib/libddwaf.so
44
+ - vendor/libddwaf/libddwaf-1.0.14-linux-x86_64/include/ddwaf.h
45
+ - vendor/libddwaf/libddwaf-1.0.14-linux-x86_64/lib/libddwaf.so
46
46
  homepage: https://github.com/DataDog/libddwaf
47
47
  licenses:
48
48
  - BSD-3-Clause
@@ -57,9 +57,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: '2.1'
60
- - - "<"
61
- - !ruby/object:Gem::Version
62
- version: '3.1'
63
60
  required_rubygems_version: !ruby/object:Gem::Requirement
64
61
  requirements:
65
62
  - - ">="