libddwaf 1.9.0.0.1-arm64-darwin → 1.11.0.0.0-arm64-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: 0ca01adcb6202628506b36f2b1bbb9431a41b24dad94811ee0880a86ded02250
4
- data.tar.gz: d6e81a7d3d76dddf3016a4ee205497f0a4f95561733c627815ba37b385c027c5
3
+ metadata.gz: b752f26eecae128465f941166bf62ed8d49ebc39ee775a57dee5bef5487b2bf4
4
+ data.tar.gz: cb050a093381af39702e9f7a1cca8228397987d3bb2a9778c3790758f0084d30
5
5
  SHA512:
6
- metadata.gz: 5225f8f51668d544e4c5a011a14565fa9569aaad619665324ae8d2d3ddc6c417dbfb2c0a485a4a24b2226385572e46b21b8cc97e20ef08cffe4278d81532e0c8
7
- data.tar.gz: ca4c0cd354dbdcaca5ec2804164ce7b0a5d603d9046328152a83121e379fbcbc3da7cc028b9f72d8d9c788c75793c6b8e26a1ca7ab88523b4e1fec7317bb5a70
6
+ metadata.gz: ddaf7638f62ca68a432ead1d2edd16c98b3ac4b976b9cc65023c2942e2b584a9c21f07889d543e76fdc6eda353d4702f6ded30ec52d5d0877508ad2396e314c1
7
+ data.tar.gz: 240f545d9ea07b70198d95e8c756b4350346bb8e42e2c891c22d2369033dea320d0939a2a8968a654c09651a17bd7f3e73b7384cb7b3965a8652853b383dea05
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: arm64-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-arm64/lib/libddwaf.dylib
45
+ - vendor/libddwaf/libddwaf-1.11.0-darwin-arm64/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