libddwaf 1.10.0.0.0-x86_64-darwin → 1.11.0.0.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 460e66f7b47fca4c5a4a1ccd22635bc909e5cef0ce7a26f2c23d0b412b0dd8cf
|
4
|
+
data.tar.gz: 4d9d11f1070b7c88ae46e8c2829790c1a744eda31dcd75f966f74795a7afa996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610cd7b48739f610f0a66e76c50c570e7e3dc897b5575230ba8408787d821abc2af3b8f97ff601532f87c5d7e6db9995e67ca3ca0994550668b75ca98c0c1905
|
7
|
+
data.tar.gz: ce46fcb2a4c54ae66cba44a2df01130e2a01613958d482f3b8d75680eeae217fd0a1d4349bfa07d9f716271681db066754a9324d36235776a89bb4a251e29fe1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# 2023-08-29 v.1.11.0.0.0
|
2
|
+
|
3
|
+
- Update to libddwaf 1.11.0
|
4
|
+
- Rename Handle#ruleset_info to Handle#diagnostics. (Breaking change)
|
5
|
+
The schema of the new diagnostics variable can be [here](https://github.com/DataDog/libddwaf/blob/master/schema/diagnostics.json)
|
6
|
+
|
7
|
+
|
8
|
+
# 2023-08-28 v.1.10.0.0.0
|
9
|
+
|
10
|
+
- Update to libddwaf 1.10.0
|
11
|
+
|
1
12
|
# 2023-06-13 v.1.9.0.0.1
|
2
13
|
|
3
14
|
- Handle invalid encoding
|
data/lib/datadog/appsec/waf.rb
CHANGED
@@ -8,10 +8,10 @@ module Datadog
|
|
8
8
|
module WAF
|
9
9
|
module LibDDWAF
|
10
10
|
class Error < StandardError
|
11
|
-
attr_reader :
|
11
|
+
attr_reader :diagnostics
|
12
12
|
|
13
|
-
def initialize(msg,
|
14
|
-
@
|
13
|
+
def initialize(msg, diagnostics: nil)
|
14
|
+
@diagnostics = diagnostics
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -216,20 +216,8 @@ module Datadog
|
|
216
216
|
|
217
217
|
typedef Config.by_ref, :ddwaf_config
|
218
218
|
|
219
|
-
|
220
|
-
|
221
|
-
:failed, :uint16,
|
222
|
-
:errors, Object,
|
223
|
-
:version, :string
|
224
|
-
end
|
225
|
-
|
226
|
-
typedef RuleSetInfo.by_ref, :ddwaf_ruleset_info
|
227
|
-
RuleSetInfoNone = Datadog::AppSec::WAF::LibDDWAF::RuleSetInfo.new(::FFI::Pointer::NULL)
|
228
|
-
|
229
|
-
attach_function :ddwaf_ruleset_info_free, [:ddwaf_ruleset_info], :void
|
230
|
-
|
231
|
-
attach_function :ddwaf_init, [:ddwaf_rule, :ddwaf_config, :ddwaf_ruleset_info], :ddwaf_handle
|
232
|
-
attach_function :ddwaf_update, [:ddwaf_handle, :ddwaf_object, :ddwaf_ruleset_info], :ddwaf_handle
|
219
|
+
attach_function :ddwaf_init, [:ddwaf_rule, :ddwaf_config, :ddwaf_object], :ddwaf_handle
|
220
|
+
attach_function :ddwaf_update, [:ddwaf_handle, :ddwaf_object, :ddwaf_object], :ddwaf_handle
|
233
221
|
attach_function :ddwaf_destroy, [:ddwaf_handle], :void
|
234
222
|
|
235
223
|
attach_function :ddwaf_required_addresses, [:ddwaf_handle, UInt32Ptr], :charptrptr
|
@@ -250,15 +238,10 @@ module Datadog
|
|
250
238
|
attach_function :ddwaf_context_init, [:ddwaf_handle], :ddwaf_context
|
251
239
|
attach_function :ddwaf_context_destroy, [:ddwaf_context], :void
|
252
240
|
|
253
|
-
class ResultActions < ::FFI::Struct
|
254
|
-
layout :array, :charptrptr,
|
255
|
-
:size, :uint32
|
256
|
-
end
|
257
|
-
|
258
241
|
class Result < ::FFI::Struct
|
259
|
-
layout :timeout,
|
260
|
-
:
|
261
|
-
:actions,
|
242
|
+
layout :timeout, :bool,
|
243
|
+
:events, Object,
|
244
|
+
:actions, Object,
|
262
245
|
:total_runtime, :uint64
|
263
246
|
end
|
264
247
|
|
@@ -479,7 +462,7 @@ module Datadog
|
|
479
462
|
}
|
480
463
|
|
481
464
|
class Handle
|
482
|
-
attr_reader :handle_obj, :
|
465
|
+
attr_reader :handle_obj, :diagnostics, :config
|
483
466
|
|
484
467
|
def initialize(rule, limits: {}, obfuscator: {})
|
485
468
|
rule_obj = Datadog::AppSec::WAF.ruby_to_object(rule)
|
@@ -501,24 +484,19 @@ module Datadog
|
|
501
484
|
|
502
485
|
@config = config_obj
|
503
486
|
|
504
|
-
|
487
|
+
diagnostics_obj = Datadog::AppSec::WAF::LibDDWAF::Object.new
|
505
488
|
|
506
|
-
@handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj,
|
489
|
+
@handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj, diagnostics_obj)
|
507
490
|
|
508
|
-
@
|
509
|
-
loaded: ruleset_info[:loaded],
|
510
|
-
failed: ruleset_info[:failed],
|
511
|
-
errors: WAF.object_to_ruby(ruleset_info[:errors]),
|
512
|
-
version: ruleset_info[:version],
|
513
|
-
}
|
491
|
+
@diagnostics = Datadog::AppSec::WAF.object_to_ruby(diagnostics_obj)
|
514
492
|
|
515
493
|
if @handle_obj.null?
|
516
|
-
fail LibDDWAF::Error.new('Could not create handle',
|
494
|
+
fail LibDDWAF::Error.new('Could not create handle', diagnostics: @diagnostics)
|
517
495
|
end
|
518
496
|
|
519
497
|
validate!
|
520
498
|
ensure
|
521
|
-
Datadog::AppSec::WAF::LibDDWAF.
|
499
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(diagnostics_obj) if diagnostics_obj
|
522
500
|
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(rule_obj) if rule_obj
|
523
501
|
end
|
524
502
|
|
@@ -541,29 +519,24 @@ module Datadog
|
|
541
519
|
|
542
520
|
def merge(data)
|
543
521
|
data_obj = Datadog::AppSec::WAF.ruby_to_object(data, coerce: false)
|
544
|
-
|
545
|
-
new_handle = Datadog::AppSec::WAF::LibDDWAF.ddwaf_update(handle_obj, data_obj,
|
522
|
+
diagnostics_obj = LibDDWAF::Object.new
|
523
|
+
new_handle = Datadog::AppSec::WAF::LibDDWAF.ddwaf_update(handle_obj, data_obj, diagnostics_obj)
|
546
524
|
|
547
525
|
return if new_handle.null?
|
548
526
|
|
549
|
-
|
550
|
-
|
551
|
-
failed: ruleset_info[:failed],
|
552
|
-
errors: WAF.object_to_ruby(ruleset_info[:errors]),
|
553
|
-
version: ruleset_info[:version],
|
554
|
-
}
|
555
|
-
new_from_handle(new_handle, info, config)
|
527
|
+
diagnostics = Datadog::AppSec::WAF.object_to_ruby(diagnostics_obj)
|
528
|
+
new_from_handle(new_handle, diagnostics, config)
|
556
529
|
ensure
|
557
530
|
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(data_obj) if data_obj
|
558
|
-
Datadog::AppSec::WAF::LibDDWAF.
|
531
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(diagnostics_obj) if diagnostics_obj
|
559
532
|
end
|
560
533
|
|
561
534
|
private
|
562
535
|
|
563
|
-
def new_from_handle(handle_object,
|
536
|
+
def new_from_handle(handle_object, diagnostics, config)
|
564
537
|
obj = self.class.allocate
|
565
538
|
obj.instance_variable_set(:@handle_obj, handle_object)
|
566
|
-
obj.instance_variable_set(:@
|
539
|
+
obj.instance_variable_set(:@diagnostics, diagnostics)
|
567
540
|
obj.instance_variable_set(:@config, config)
|
568
541
|
obj
|
569
542
|
end
|
@@ -588,11 +561,11 @@ module Datadog
|
|
588
561
|
end
|
589
562
|
|
590
563
|
class Result
|
591
|
-
attr_reader :status, :
|
564
|
+
attr_reader :status, :events, :total_runtime, :timeout, :actions
|
592
565
|
|
593
|
-
def initialize(status,
|
566
|
+
def initialize(status, events, total_runtime, timeout, actions)
|
594
567
|
@status = status
|
595
|
-
@
|
568
|
+
@events = events
|
596
569
|
@total_runtime = total_runtime
|
597
570
|
@timeout = timeout
|
598
571
|
@actions = actions
|
@@ -651,18 +624,12 @@ module Datadog
|
|
651
624
|
|
652
625
|
code = Datadog::AppSec::WAF::LibDDWAF.ddwaf_run(@context_obj, input_obj, result_obj, timeout)
|
653
626
|
|
654
|
-
actions = if result_obj[:actions][:size] > 0
|
655
|
-
result_obj[:actions][:array].get_array_of_string(0, result_obj[:actions][:size])
|
656
|
-
else
|
657
|
-
[]
|
658
|
-
end
|
659
|
-
|
660
627
|
result = Result.new(
|
661
628
|
RESULT_CODE[code],
|
662
|
-
|
629
|
+
Datadog::AppSec::WAF.object_to_ruby(result_obj[:events]),
|
663
630
|
result_obj[:total_runtime],
|
664
631
|
result_obj[:timeout],
|
665
|
-
actions,
|
632
|
+
Datadog::AppSec::WAF.object_to_ruby(result_obj[:actions]),
|
666
633
|
)
|
667
634
|
|
668
635
|
[RESULT_CODE[code], result]
|
Binary file
|
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.
|
4
|
+
version: 1.11.0.0.0
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -42,7 +42,7 @@ files:
|
|
42
42
|
- lib/datadog/appsec/waf.rb
|
43
43
|
- lib/datadog/appsec/waf/version.rb
|
44
44
|
- lib/libddwaf.rb
|
45
|
-
- vendor/libddwaf/libddwaf-1.
|
45
|
+
- vendor/libddwaf/libddwaf-1.11.0-darwin-x86_64/lib/libddwaf.dylib
|
46
46
|
homepage: https://github.com/DataDog/libddwaf-rb
|
47
47
|
licenses:
|
48
48
|
- BSD-3-Clause
|