libddwaf 1.9.0.0.1-x86_64-darwin → 1.11.0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14769a543d1fb92ad21b5b1165fb45b39161676bb1e1c83329ddd01486d85cfb
4
- data.tar.gz: 3b3dd97ae54de084231c46f3f6e27a19fb7e804c6eb0a8cba0008c0c2f0a2f48
3
+ metadata.gz: 460e66f7b47fca4c5a4a1ccd22635bc909e5cef0ce7a26f2c23d0b412b0dd8cf
4
+ data.tar.gz: 4d9d11f1070b7c88ae46e8c2829790c1a744eda31dcd75f966f74795a7afa996
5
5
  SHA512:
6
- metadata.gz: 250814704c92b073bc0f86d6ceb3ad9903c0395e95f4b6201a69bc02f44045c6c496bc353ec98de4f77749b0f5b95067e0c7c80e0a6f55c15ccefe5fc4107ecf
7
- data.tar.gz: 69eb5967576d4f197592756fa1483a6426021cbb134ed292b427d4164682794370274056f269c62fd93776208c6a29865fdba9e0d3ab4cc77c5113c95b5c9ac4
6
+ metadata.gz: 610cd7b48739f610f0a66e76c50c570e7e3dc897b5575230ba8408787d821abc2af3b8f97ff601532f87c5d7e6db9995e67ca3ca0994550668b75ca98c0c1905
7
+ data.tar.gz: ce46fcb2a4c54ae66cba44a2df01130e2a01613958d482f3b8d75680eeae217fd0a1d4349bfa07d9f716271681db066754a9324d36235776a89bb4a251e29fe1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
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
+
12
+ # 2023-06-13 v.1.9.0.0.1
13
+
14
+ - Handle invalid encoding
15
+ - Ensure strings passed to libddwaf are not clipped inside a code point
16
+ - Ensure strings passed to libddwaf are UTF-8
17
+
18
+ # 2023-05-17 v1.9.0.0.0
19
+
20
+ - Update to libddwaf 1.9.0
21
+ - Support [`custom_rules`](https://github.com/DataDog/libddwaf/pull/154)
22
+
1
23
  # 2023-03-03 v1.8.2.0.0
2
24
 
3
25
  - Update to libddwaf 1.8.2
@@ -2,8 +2,8 @@ module Datadog
2
2
  module AppSec
3
3
  module WAF
4
4
  module VERSION
5
- BASE_STRING = '1.9.0'
6
- STRING = "#{BASE_STRING}.0.1"
5
+ BASE_STRING = '1.11.0'
6
+ STRING = "#{BASE_STRING}.0.0"
7
7
  MINIMUM_RUBY_VERSION = '2.1'
8
8
  end
9
9
  end
@@ -8,10 +8,10 @@ module Datadog
8
8
  module WAF
9
9
  module LibDDWAF
10
10
  class Error < StandardError
11
- attr_reader :ruleset_info
11
+ attr_reader :diagnostics
12
12
 
13
- def initialize(msg, ruleset_info: nil)
14
- @ruleset_info = ruleset_info
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
- class RuleSetInfo < ::FFI::Struct
220
- layout :loaded, :uint16,
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, :bool,
260
- :data, :string,
261
- :actions, ResultActions,
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, :ruleset_info, :config
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
- ruleset_info = LibDDWAF::RuleSetInfo.new
487
+ diagnostics_obj = Datadog::AppSec::WAF::LibDDWAF::Object.new
505
488
 
506
- @handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj, ruleset_info)
489
+ @handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj, diagnostics_obj)
507
490
 
508
- @ruleset_info = {
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', ruleset_info: @ruleset_info)
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.ddwaf_ruleset_info_free(ruleset_info) if ruleset_info
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
- ruleset_info = LibDDWAF::RuleSetInfo.new
545
- new_handle = Datadog::AppSec::WAF::LibDDWAF.ddwaf_update(handle_obj, data_obj, ruleset_info)
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
- info = {
550
- loaded: ruleset_info[:loaded],
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.ddwaf_ruleset_info_free(ruleset_info) if ruleset_info
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, info, config)
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(:@ruleset_info, info)
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, :data, :total_runtime, :timeout, :actions
564
+ attr_reader :status, :events, :total_runtime, :timeout, :actions
592
565
 
593
- def initialize(status, data, total_runtime, timeout, actions)
566
+ def initialize(status, events, total_runtime, timeout, actions)
594
567
  @status = status
595
- @data = data
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
- (JSON.parse(result_obj[:data]) if result_obj[:data] != nil),
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]
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.9.0.0.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-06-13 00:00:00.000000000 Z
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.9.0-darwin-x86_64/lib/libddwaf.dylib
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
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: 2.0.0
65
65
  requirements: []
66
- rubygems_version: 3.4.13
66
+ rubygems_version: 3.4.19
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Datadog WAF