libddwaf 1.9.0.0.1-aarch64-linux → 1.11.0.0.0-aarch64-linux

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: 4dc4fa38132988444aaca2632bc80358b227f04f88d4e591d8a4616a2d79cb77
4
- data.tar.gz: b18ffaddd58d71ed9968424fc0ff72910bff499aabf1bccacc176b10933c4e86
3
+ metadata.gz: 74fe47bb803947a5c3b3af241ea591771729a51bf00a20f2dc2a2e47adf6bd85
4
+ data.tar.gz: 6f2ea62192636b5e2abc2ad63d4a9b9757504440fe6e19ed47ca36dd2c084aff
5
5
  SHA512:
6
- metadata.gz: '08bfaa1def38f2f3cd6b475c090ec9400bf4eb1cc73b31da2a7f41616fe9f47bbe8a1b0037f186b48b5f3555af81ae18b86613ed18a6dfe8af881917d73190b5'
7
- data.tar.gz: 32d5b7cd929fee1cc378b5f66b33b5dd6f8ac2900fd5feb307fedbe23aa29c742770267cd47b5284115c2362513126ff172a9cae18f57987450736950e2075c0
6
+ metadata.gz: 816fe653ca7614359f7e69f198bc8d702977856577b74d5a2659703220fdc1db1db638e7e28cc55272d5bc0580403b46a673c0736cb1733042a85cdb0191bd7a
7
+ data.tar.gz: 51636c8951e55d7c7fb53ff719537f7298e9d1484ef06e78d92c901778921a773db430df546385e08aa0fa5fc6e70cb2f386c4e9a708a43e9d903bcac75c8f1e
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: aarch64-linux
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-linux-aarch64/lib/libddwaf.so
45
+ - vendor/libddwaf/libddwaf-1.11.0-linux-aarch64/lib/libddwaf.so
46
46
  homepage: https://github.com/DataDog/libddwaf-rb
47
47
  licenses:
48
48
  - BSD-3-Clause