libddwaf 1.0.14.0.0.beta1-x86_64-darwin → 1.0.14.1.0.beta1-x86_64-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/waf/version.rb +1 -1
- data/lib/datadog/security/waf.rb +33 -27
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc825858a2475f45c780d5a69514f25e393b99fb69b824e10ce7398043090312
|
4
|
+
data.tar.gz: e238f22260ddcede68dc562dfe8b44f42558b85d8ab179d087ce074a3f952740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f54521687468249efa2a3096409f01eff5012e4ce478b0b33e99e9b1bfe491af55d1ab878ea6f40c689990695c4456f770d163fdf130bd5ea23d4b87a9662dba
|
7
|
+
data.tar.gz: e78a11ee06eaff2b5d98810ad984480d83e34eae2307b308f8d719315ce0a2fcdaa1fff9126dcb97ebb81cd65069262892388f443fed72e64fc79bf493a27969
|
data/lib/datadog/security/waf.rb
CHANGED
@@ -15,10 +15,10 @@ module Datadog
|
|
15
15
|
os_name = java.lang.System.get_property('os.name')
|
16
16
|
|
17
17
|
os = case os_name
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
when /linux/i then 'linux'
|
19
|
+
when /mac/i then 'darwin'
|
20
|
+
else raise Error, "unsupported JRuby os.name: #{os_name.inspect}"
|
21
|
+
end
|
22
22
|
|
23
23
|
return os
|
24
24
|
end
|
@@ -55,8 +55,8 @@ module Datadog
|
|
55
55
|
|
56
56
|
class Version < ::FFI::Struct
|
57
57
|
layout :major, :uint16,
|
58
|
-
|
59
|
-
|
58
|
+
:minor, :uint16,
|
59
|
+
:patch, :uint16
|
60
60
|
end
|
61
61
|
|
62
62
|
typedef Version.by_ref, :ddwaf_version
|
@@ -76,17 +76,17 @@ module Datadog
|
|
76
76
|
|
77
77
|
class ObjectValueUnion < ::FFI::Union
|
78
78
|
layout :stringValue, :charptr,
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
:uintValue, :uint64,
|
80
|
+
:intValue, :int64,
|
81
|
+
:array, :pointer
|
82
82
|
end
|
83
83
|
|
84
84
|
class Object < ::FFI::Struct
|
85
85
|
layout :parameterName, :charptr,
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
:parameterNameLength, :uint64,
|
87
|
+
:valueUnion, ObjectValueUnion,
|
88
|
+
:nbEntries, :uint64,
|
89
|
+
:type, DDWAF_OBJ_TYPE
|
90
90
|
end
|
91
91
|
|
92
92
|
typedef Object.by_ref, :ddwaf_object
|
@@ -118,8 +118,8 @@ module Datadog
|
|
118
118
|
|
119
119
|
class Config < ::FFI::Struct
|
120
120
|
layout :maxArrayLength, :uint64,
|
121
|
-
|
122
|
-
|
121
|
+
:maxMapDepth, :uint64,
|
122
|
+
:maxTimeStore, :uint64
|
123
123
|
end
|
124
124
|
|
125
125
|
typedef Config.by_ref, :ddwaf_config
|
@@ -136,7 +136,6 @@ module Datadog
|
|
136
136
|
attach_function :ddwaf_context_init, [:ddwaf_handle, :ddwaf_object_free_fn], :ddwaf_context
|
137
137
|
attach_function :ddwaf_context_destroy, [:ddwaf_context], :void
|
138
138
|
|
139
|
-
|
140
139
|
DDWAF_RET_CODE = enum :ddwaf_err_internal, -4,
|
141
140
|
:ddwaf_err_invalid_object, -3,
|
142
141
|
:ddwaf_err_invalid_argument, -2,
|
@@ -147,9 +146,9 @@ module Datadog
|
|
147
146
|
|
148
147
|
class Result < ::FFI::Struct
|
149
148
|
layout :action, DDWAF_RET_CODE,
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
:data, :string,
|
150
|
+
:perfData, :string,
|
151
|
+
:perfTotalRuntime, :uint32 # in us
|
153
152
|
end
|
154
153
|
|
155
154
|
typedef Result.by_ref, :ddwaf_result
|
@@ -161,11 +160,11 @@ module Datadog
|
|
161
160
|
# logging
|
162
161
|
|
163
162
|
DDWAF_LOG_LEVEL = enum :ddwaf_log_trace,
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
163
|
+
:ddwaf_log_debug,
|
164
|
+
:ddwaf_log_info,
|
165
|
+
:ddwaf_log_warn,
|
166
|
+
:ddwaf_log_error,
|
167
|
+
:ddwaf_log_off
|
169
168
|
|
170
169
|
callback :ddwaf_log_cb, [DDWAF_LOG_LEVEL, :string, :string, :uint, :charptr, :uint64], :void
|
171
170
|
|
@@ -351,11 +350,16 @@ module Datadog
|
|
351
350
|
fail LibDDWAF::Error, 'Could not create context'
|
352
351
|
end
|
353
352
|
|
354
|
-
|
353
|
+
@input_objs = []
|
354
|
+
|
355
|
+
ObjectSpace.define_finalizer(self, Context.finalizer(context_obj, @input_objs))
|
355
356
|
end
|
356
357
|
|
357
|
-
def self.finalizer(context_obj)
|
358
|
+
def self.finalizer(context_obj, input_objs)
|
358
359
|
proc do |object_id|
|
360
|
+
input_objs.each do |input_obj|
|
361
|
+
Datadog::Security::WAF::LibDDWAF.ddwaf_object_free(input_obj)
|
362
|
+
end
|
359
363
|
Datadog::Security::WAF::LibDDWAF.ddwaf_context_destroy(context_obj)
|
360
364
|
end
|
361
365
|
end
|
@@ -382,6 +386,9 @@ module Datadog
|
|
382
386
|
fail LibDDWAF::Error, "Could not create result object"
|
383
387
|
end
|
384
388
|
|
389
|
+
# retain C objects in memory for subsequent calls to run
|
390
|
+
@input_objs << input_obj
|
391
|
+
|
385
392
|
code = Datadog::Security::WAF::LibDDWAF.ddwaf_run(@context_obj, input_obj, result_obj, timeout)
|
386
393
|
|
387
394
|
result = Result.new(
|
@@ -393,7 +400,6 @@ module Datadog
|
|
393
400
|
|
394
401
|
[ACTION_MAP_OUT[code], result]
|
395
402
|
ensure
|
396
|
-
Datadog::Security::WAF::LibDDWAF.ddwaf_object_free(input_obj) if input_obj
|
397
403
|
Datadog::Security::WAF::LibDDWAF.ddwaf_result_free(result_obj) if result_obj
|
398
404
|
end
|
399
405
|
end
|
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.1.0.beta1
|
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: 2021-
|
11
|
+
date: 2021-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 2.0.0
|
68
68
|
requirements: []
|
69
|
-
rubygems_version: 3.2.
|
69
|
+
rubygems_version: 3.2.33
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Datadog WAF
|