libddwaf 1.0.14.1.0.beta2-arm64-darwin → 1.0.14.2.0.beta1-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datadog/{security → appsec}/waf/version.rb +2 -2
- data/lib/datadog/{security → appsec}/waf.rb +19 -19
- data/lib/libddwaf.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66d1b5f6d0716114d53088539c65904fe754514c301292b6a3a92193f947fa4
|
4
|
+
data.tar.gz: 49d381f84e13892270e9e7768c511f2a9ea47c806712e9d9d6617a04e7ab6c4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 149307a314e594efdd409a201222188cb188486f4c37012e126e48338caaa329b09e8c606ea330bd8ef8fd9e64dd04b531cca3bdb02a69b69087ce1a154010cf
|
7
|
+
data.tar.gz: 8d8f633a3848e361449d2e4dcc6c49c482f636995821097304c83d957ece455edec1482a03a808ba1238d7c61a3b7acf45fbb9d75509e28b30903bdc0e1d6e59
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'ffi'
|
2
2
|
require 'json'
|
3
|
-
require 'datadog/
|
3
|
+
require 'datadog/appsec/waf/version'
|
4
4
|
|
5
5
|
module Datadog
|
6
|
-
module
|
6
|
+
module AppSec
|
7
7
|
module WAF
|
8
8
|
module LibDDWAF
|
9
9
|
class Error < StandardError; end
|
@@ -46,7 +46,7 @@ module Datadog
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.shared_lib_path
|
49
|
-
File.join(__dir__, "../../../vendor/libddwaf/libddwaf-#{Datadog::
|
49
|
+
File.join(__dir__, "../../../vendor/libddwaf/libddwaf-#{Datadog::AppSec::WAF::VERSION::BASE_STRING}-#{local_os}-#{local_cpu}/lib/libddwaf#{shared_lib_extname}")
|
50
50
|
end
|
51
51
|
|
52
52
|
ffi_lib [shared_lib_path]
|
@@ -281,8 +281,8 @@ module Datadog
|
|
281
281
|
end
|
282
282
|
when :ddwaf_obj_map
|
283
283
|
(0...obj[:nbEntries]).each.with_object({}) do |i, h|
|
284
|
-
ptr = obj[:valueUnion][:array] + i * Datadog::
|
285
|
-
o = Datadog::
|
284
|
+
ptr = obj[:valueUnion][:array] + i * Datadog::AppSec::WAF::LibDDWAF::Object.size
|
285
|
+
o = Datadog::AppSec::WAF::LibDDWAF::Object.new(ptr)
|
286
286
|
l = o[:parameterNameLength]
|
287
287
|
k = o[:parameterName].read_bytes(l)
|
288
288
|
v = object_to_ruby(LibDDWAF::Object.new(ptr))
|
@@ -296,7 +296,7 @@ module Datadog
|
|
296
296
|
logger.debug { { level: level, func: func, file: file, message: message.read_bytes(len) }.inspect }
|
297
297
|
end
|
298
298
|
|
299
|
-
Datadog::
|
299
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_set_log_cb(@log_cb, :ddwaf_log_trace)
|
300
300
|
end
|
301
301
|
|
302
302
|
class Handle
|
@@ -307,12 +307,12 @@ module Datadog
|
|
307
307
|
DEFAULT_MAX_TIME_STORE = 0
|
308
308
|
|
309
309
|
def initialize(rule, config = {})
|
310
|
-
rule_obj = Datadog::
|
310
|
+
rule_obj = Datadog::AppSec::WAF.ruby_to_object(rule)
|
311
311
|
if rule_obj.null? || rule_obj[:type] == :ddwaf_object_invalid
|
312
312
|
fail LibDDWAF::Error, "Could not convert object #{rule.inspect}"
|
313
313
|
end
|
314
314
|
|
315
|
-
config_obj = Datadog::
|
315
|
+
config_obj = Datadog::AppSec::WAF::LibDDWAF::Config.new
|
316
316
|
if config_obj.null?
|
317
317
|
fail LibDDWAF::Error, 'Could not create config struct'
|
318
318
|
end
|
@@ -321,19 +321,19 @@ module Datadog
|
|
321
321
|
config_obj[:maxMapDepth] = config[:max_map_depth] || DEFAULT_MAX_MAP_DEPTH
|
322
322
|
config_obj[:maxTimeStore] = config[:max_time_store] || DEFAULT_MAX_TIME_STORE
|
323
323
|
|
324
|
-
@handle_obj = Datadog::
|
324
|
+
@handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj)
|
325
325
|
if @handle_obj.null?
|
326
326
|
fail LibDDWAF::Error, 'Could not create handle'
|
327
327
|
end
|
328
328
|
|
329
329
|
ObjectSpace.define_finalizer(self, Handle.finalizer(handle_obj))
|
330
330
|
ensure
|
331
|
-
Datadog::
|
331
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(rule_obj) if rule_obj
|
332
332
|
end
|
333
333
|
|
334
334
|
def self.finalizer(handle_obj)
|
335
335
|
proc do |object_id|
|
336
|
-
Datadog::
|
336
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_destroy(handle_obj)
|
337
337
|
end
|
338
338
|
end
|
339
339
|
end
|
@@ -345,9 +345,9 @@ module Datadog
|
|
345
345
|
|
346
346
|
def initialize(handle)
|
347
347
|
handle_obj = handle.handle_obj
|
348
|
-
free_func = Datadog::
|
348
|
+
free_func = Datadog::AppSec::WAF::LibDDWAF::ObjectNoFree
|
349
349
|
|
350
|
-
@context_obj = Datadog::
|
350
|
+
@context_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_context_init(handle_obj, free_func)
|
351
351
|
if @context_obj.null?
|
352
352
|
fail LibDDWAF::Error, 'Could not create context'
|
353
353
|
end
|
@@ -360,9 +360,9 @@ module Datadog
|
|
360
360
|
def self.finalizer(context_obj, input_objs)
|
361
361
|
proc do |object_id|
|
362
362
|
input_objs.each do |input_obj|
|
363
|
-
Datadog::
|
363
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(input_obj)
|
364
364
|
end
|
365
|
-
Datadog::
|
365
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_context_destroy(context_obj)
|
366
366
|
end
|
367
367
|
end
|
368
368
|
|
@@ -378,12 +378,12 @@ module Datadog
|
|
378
378
|
}
|
379
379
|
|
380
380
|
def run(input, timeout = DEFAULT_TIMEOUT_US)
|
381
|
-
input_obj = Datadog::
|
381
|
+
input_obj = Datadog::AppSec::WAF.ruby_to_object(input)
|
382
382
|
if input_obj.null?
|
383
383
|
fail LibDDWAF::Error, "Could not convert input: #{input.inspect}"
|
384
384
|
end
|
385
385
|
|
386
|
-
result_obj = Datadog::
|
386
|
+
result_obj = Datadog::AppSec::WAF::LibDDWAF::Result.new
|
387
387
|
if result_obj.null?
|
388
388
|
fail LibDDWAF::Error, "Could not create result object"
|
389
389
|
end
|
@@ -391,7 +391,7 @@ module Datadog
|
|
391
391
|
# retain C objects in memory for subsequent calls to run
|
392
392
|
@input_objs << input_obj
|
393
393
|
|
394
|
-
code = Datadog::
|
394
|
+
code = Datadog::AppSec::WAF::LibDDWAF.ddwaf_run(@context_obj, input_obj, result_obj, timeout)
|
395
395
|
|
396
396
|
result = Result.new(
|
397
397
|
ACTION_MAP_OUT[result_obj[:action]],
|
@@ -402,7 +402,7 @@ module Datadog
|
|
402
402
|
|
403
403
|
[ACTION_MAP_OUT[code], result]
|
404
404
|
ensure
|
405
|
-
Datadog::
|
405
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_result_free(result_obj) if result_obj
|
406
406
|
end
|
407
407
|
end
|
408
408
|
end
|
data/lib/libddwaf.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'datadog/
|
1
|
+
require 'datadog/appsec/waf'
|
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.0.14.
|
4
|
+
version: 1.0.14.2.0.beta1
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -38,8 +38,8 @@ files:
|
|
38
38
|
- LICENSE.Apache
|
39
39
|
- LICENSE.BSD3
|
40
40
|
- NOTICE
|
41
|
-
- lib/datadog/
|
42
|
-
- lib/datadog/
|
41
|
+
- lib/datadog/appsec/waf.rb
|
42
|
+
- lib/datadog/appsec/waf/version.rb
|
43
43
|
- lib/libddwaf.rb
|
44
44
|
- vendor/libddwaf/libddwaf-1.0.14-darwin-arm64/include/ddwaf.h
|
45
45
|
- vendor/libddwaf/libddwaf-1.0.14-darwin-arm64/lib/libddwaf.dylib
|