libddwaf 1.0.14.1.0.beta2-aarch64-linux → 1.2.1.0.0.beta1-aarch64-linux
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 +4 -4
- data/lib/datadog/{security → appsec}/waf/version.rb +3 -3
- data/lib/datadog/{security → appsec}/waf.rb +82 -45
- data/lib/libddwaf.rb +1 -1
- data/vendor/libddwaf/{libddwaf-1.0.14-linux-aarch64 → libddwaf-1.2.1-linux-aarch64}/include/ddwaf.h +143 -17
- data/vendor/libddwaf/libddwaf-1.2.1-linux-aarch64/lib/libddwaf.so +0 -0
- metadata +6 -6
- data/vendor/libddwaf/libddwaf-1.0.14-linux-aarch64/lib/libddwaf.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfb2432bc222dbfdb31746689817e5daf2db7c33a529820a8ded0cb8562dbdfe
|
4
|
+
data.tar.gz: 0e9107e0a6051237816dd853b5cfd7afa06df2491056fcc4298898b1dfc579c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21998b8bfc616220ee5a0b7a81565576bb4a8010fd8419cf617b6a9bd643630760f8b04550d66f8d148692770ef89173f1b63d7a9f609e4a8006e9fa59b54f16
|
7
|
+
data.tar.gz: de70ff25315ddd224985021935913d27c054af0eba5c03d6272757a028b9e42745f475198028c4efad5f77a5cb7c67c03ca62c6a9a5cc3605e2f5052089fa529
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'ffi'
|
2
2
|
require 'json'
|
3
|
-
require 'datadog/
|
3
|
+
require 'datadog/appsec/waf/version'
|
4
4
|
|
5
5
|
module Datadog
|
6
|
-
module
|
6
|
+
module AppSec
|
7
7
|
module WAF
|
8
8
|
module LibDDWAF
|
9
9
|
class Error < StandardError; end
|
@@ -46,7 +46,7 @@ module Datadog
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.shared_lib_path
|
49
|
-
File.join(__dir__, "../../../vendor/libddwaf/libddwaf-#{Datadog::
|
49
|
+
File.join(__dir__, "../../../vendor/libddwaf/libddwaf-#{Datadog::AppSec::WAF::VERSION::BASE_STRING}-#{local_os}-#{local_cpu}/lib/libddwaf#{shared_lib_extname}")
|
50
50
|
end
|
51
51
|
|
52
52
|
ffi_lib [shared_lib_path]
|
@@ -73,6 +73,25 @@ module Datadog
|
|
73
73
|
:ddwaf_obj_map, 1 << 4
|
74
74
|
|
75
75
|
typedef :pointer, :charptr
|
76
|
+
typedef :pointer, :charptrptr
|
77
|
+
|
78
|
+
class UInt32Ptr < ::FFI::Struct
|
79
|
+
layout :value, :uint32
|
80
|
+
end
|
81
|
+
|
82
|
+
typedef UInt32Ptr.by_ref, :uint32ptr
|
83
|
+
|
84
|
+
class UInt64Ptr < ::FFI::Struct
|
85
|
+
layout :value, :uint64
|
86
|
+
end
|
87
|
+
|
88
|
+
typedef UInt64Ptr.by_ref, :uint64ptr
|
89
|
+
|
90
|
+
class SizeTPtr < ::FFI::Struct
|
91
|
+
layout :value, :size_t
|
92
|
+
end
|
93
|
+
|
94
|
+
typedef SizeTPtr.by_ref, :sizeptr
|
76
95
|
|
77
96
|
class ObjectValueUnion < ::FFI::Union
|
78
97
|
layout :stringValue, :charptr,
|
@@ -91,6 +110,8 @@ module Datadog
|
|
91
110
|
|
92
111
|
typedef Object.by_ref, :ddwaf_object
|
93
112
|
|
113
|
+
## setters
|
114
|
+
|
94
115
|
attach_function :ddwaf_object_invalid, [:ddwaf_object], :ddwaf_object
|
95
116
|
attach_function :ddwaf_object_string, [:ddwaf_object, :string], :ddwaf_object
|
96
117
|
attach_function :ddwaf_object_stringl, [:ddwaf_object, :charptr, :size_t], :ddwaf_object
|
@@ -108,6 +129,19 @@ module Datadog
|
|
108
129
|
attach_function :ddwaf_object_map_addl, [:ddwaf_object, :charptr, :size_t, :pointer], :bool
|
109
130
|
attach_function :ddwaf_object_map_addl_nc, [:ddwaf_object, :charptr, :size_t, :pointer], :bool
|
110
131
|
|
132
|
+
## getters
|
133
|
+
|
134
|
+
attach_function :ddwaf_object_type, [:ddwaf_object], DDWAF_OBJ_TYPE
|
135
|
+
attach_function :ddwaf_object_size, [:ddwaf_object], :uint64
|
136
|
+
attach_function :ddwaf_object_length, [:ddwaf_object], :size_t
|
137
|
+
attach_function :ddwaf_object_get_key, [:ddwaf_object, :sizeptr], :charptr
|
138
|
+
attach_function :ddwaf_object_get_string, [:ddwaf_object, :sizeptr], :charptr
|
139
|
+
attach_function :ddwaf_object_get_unsigned, [:ddwaf_object], :uint64
|
140
|
+
attach_function :ddwaf_object_get_signed, [:ddwaf_object], :int64
|
141
|
+
attach_function :ddwaf_object_get_index, [:ddwaf_object, :size_t], :ddwaf_object
|
142
|
+
|
143
|
+
## freeers
|
144
|
+
|
111
145
|
ObjectFree = attach_function :ddwaf_object_free, [:ddwaf_object], :void
|
112
146
|
ObjectNoFree = ::FFI::Pointer::NULL
|
113
147
|
|
@@ -118,16 +152,27 @@ module Datadog
|
|
118
152
|
|
119
153
|
class Config < ::FFI::Struct
|
120
154
|
layout :maxArrayLength, :uint64,
|
121
|
-
:maxMapDepth, :uint64
|
122
|
-
:maxTimeStore, :uint64
|
155
|
+
:maxMapDepth, :uint64
|
123
156
|
end
|
124
157
|
|
125
158
|
typedef Config.by_ref, :ddwaf_config
|
126
159
|
|
127
|
-
|
160
|
+
class RuleSetInfo < ::FFI::Struct
|
161
|
+
layout :loaded, :uint16,
|
162
|
+
:failed, :uint16,
|
163
|
+
:errors, Object,
|
164
|
+
:version, :string
|
165
|
+
end
|
166
|
+
|
167
|
+
typedef RuleSetInfo.by_ref, :ddwaf_ruleset_info
|
168
|
+
RuleSetInfoNone = Datadog::AppSec::WAF::LibDDWAF::RuleSetInfo.new(::FFI::Pointer::NULL)
|
169
|
+
|
170
|
+
attach_function :ddwaf_ruleset_info_free, [:ddwaf_ruleset_info], :void
|
171
|
+
|
172
|
+
attach_function :ddwaf_init, [:ddwaf_rule, :ddwaf_config, :ddwaf_ruleset_info], :ddwaf_handle
|
128
173
|
attach_function :ddwaf_destroy, [:ddwaf_handle], :void
|
129
174
|
|
130
|
-
attach_function :ddwaf_required_addresses, [:ddwaf_handle, :
|
175
|
+
attach_function :ddwaf_required_addresses, [:ddwaf_handle, :uint32ptr], :charptrptr
|
131
176
|
|
132
177
|
# running
|
133
178
|
|
@@ -138,19 +183,17 @@ module Datadog
|
|
138
183
|
attach_function :ddwaf_context_init, [:ddwaf_handle, :ddwaf_object_free_fn], :ddwaf_context
|
139
184
|
attach_function :ddwaf_context_destroy, [:ddwaf_context], :void
|
140
185
|
|
141
|
-
DDWAF_RET_CODE = enum :ddwaf_err_internal, -
|
142
|
-
:ddwaf_err_invalid_object, -
|
143
|
-
:ddwaf_err_invalid_argument, -
|
144
|
-
:ddwaf_err_timeout, -1,
|
186
|
+
DDWAF_RET_CODE = enum :ddwaf_err_internal, -3,
|
187
|
+
:ddwaf_err_invalid_object, -2,
|
188
|
+
:ddwaf_err_invalid_argument, -1,
|
145
189
|
:ddwaf_good, 0,
|
146
190
|
:ddwaf_monitor, 1,
|
147
191
|
:ddwaf_block, 2
|
148
192
|
|
149
193
|
class Result < ::FFI::Struct
|
150
|
-
layout :
|
194
|
+
layout :timeout, :bool,
|
151
195
|
:data, :string,
|
152
|
-
:
|
153
|
-
:perfTotalRuntime, :uint32 # in us
|
196
|
+
:total_runtime, :uint64
|
154
197
|
end
|
155
198
|
|
156
199
|
typedef Result.by_ref, :ddwaf_result
|
@@ -253,13 +296,7 @@ module Datadog
|
|
253
296
|
|
254
297
|
obj
|
255
298
|
else
|
256
|
-
|
257
|
-
res = LibDDWAF.ddwaf_object_invalid(obj)
|
258
|
-
if res.null?
|
259
|
-
fail LibDDWAF::Error, "Could not convert into object: #{val}"
|
260
|
-
end
|
261
|
-
|
262
|
-
obj
|
299
|
+
ruby_to_object(''.freeze)
|
263
300
|
end
|
264
301
|
end
|
265
302
|
|
@@ -281,8 +318,8 @@ module Datadog
|
|
281
318
|
end
|
282
319
|
when :ddwaf_obj_map
|
283
320
|
(0...obj[:nbEntries]).each.with_object({}) do |i, h|
|
284
|
-
ptr = obj[:valueUnion][:array] + i * Datadog::
|
285
|
-
o = Datadog::
|
321
|
+
ptr = obj[:valueUnion][:array] + i * Datadog::AppSec::WAF::LibDDWAF::Object.size
|
322
|
+
o = Datadog::AppSec::WAF::LibDDWAF::Object.new(ptr)
|
286
323
|
l = o[:parameterNameLength]
|
287
324
|
k = o[:parameterName].read_bytes(l)
|
288
325
|
v = object_to_ruby(LibDDWAF::Object.new(ptr))
|
@@ -293,10 +330,10 @@ module Datadog
|
|
293
330
|
|
294
331
|
def self.logger=(logger)
|
295
332
|
@log_cb = proc do |level, func, file, line, message, len|
|
296
|
-
logger.debug { { level: level, func: func, file: file, message: message.read_bytes(len) }.inspect }
|
333
|
+
logger.debug { { level: level, func: func, file: file, line: line, message: message.read_bytes(len) }.inspect }
|
297
334
|
end
|
298
335
|
|
299
|
-
Datadog::
|
336
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_set_log_cb(@log_cb, :ddwaf_log_trace)
|
300
337
|
end
|
301
338
|
|
302
339
|
class Handle
|
@@ -304,50 +341,51 @@ module Datadog
|
|
304
341
|
|
305
342
|
DEFAULT_MAX_ARRAY_LENGTH = 0
|
306
343
|
DEFAULT_MAX_MAP_DEPTH = 0
|
307
|
-
DEFAULT_MAX_TIME_STORE = 0
|
308
344
|
|
309
345
|
def initialize(rule, config = {})
|
310
|
-
rule_obj = Datadog::
|
346
|
+
rule_obj = Datadog::AppSec::WAF.ruby_to_object(rule)
|
311
347
|
if rule_obj.null? || rule_obj[:type] == :ddwaf_object_invalid
|
312
348
|
fail LibDDWAF::Error, "Could not convert object #{rule.inspect}"
|
313
349
|
end
|
314
350
|
|
315
|
-
config_obj = Datadog::
|
351
|
+
config_obj = Datadog::AppSec::WAF::LibDDWAF::Config.new
|
316
352
|
if config_obj.null?
|
317
353
|
fail LibDDWAF::Error, 'Could not create config struct'
|
318
354
|
end
|
319
355
|
|
320
356
|
config_obj[:maxArrayLength] = config[:max_array_length] || DEFAULT_MAX_ARRAY_LENGTH
|
321
357
|
config_obj[:maxMapDepth] = config[:max_map_depth] || DEFAULT_MAX_MAP_DEPTH
|
322
|
-
config_obj[:maxTimeStore] = config[:max_time_store] || DEFAULT_MAX_TIME_STORE
|
323
358
|
|
324
|
-
|
359
|
+
ruleset_info = LibDDWAF::RuleSetInfoNone
|
360
|
+
|
361
|
+
@handle_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_init(rule_obj, config_obj, ruleset_info)
|
325
362
|
if @handle_obj.null?
|
326
363
|
fail LibDDWAF::Error, 'Could not create handle'
|
327
364
|
end
|
328
365
|
|
329
366
|
ObjectSpace.define_finalizer(self, Handle.finalizer(handle_obj))
|
330
367
|
ensure
|
331
|
-
Datadog::
|
368
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_ruleset_info_free(ruleset_info) if ruleset_info
|
369
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(rule_obj) if rule_obj
|
332
370
|
end
|
333
371
|
|
334
372
|
def self.finalizer(handle_obj)
|
335
373
|
proc do |object_id|
|
336
|
-
Datadog::
|
374
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_destroy(handle_obj)
|
337
375
|
end
|
338
376
|
end
|
339
377
|
end
|
340
378
|
|
341
|
-
Result = Struct.new(:action, :data, :
|
379
|
+
Result = Struct.new(:action, :data, :total_runtime, :timeout)
|
342
380
|
|
343
381
|
class Context
|
344
382
|
attr_reader :context_obj
|
345
383
|
|
346
384
|
def initialize(handle)
|
347
385
|
handle_obj = handle.handle_obj
|
348
|
-
free_func = Datadog::
|
386
|
+
free_func = Datadog::AppSec::WAF::LibDDWAF::ObjectNoFree
|
349
387
|
|
350
|
-
@context_obj = Datadog::
|
388
|
+
@context_obj = Datadog::AppSec::WAF::LibDDWAF.ddwaf_context_init(handle_obj, free_func)
|
351
389
|
if @context_obj.null?
|
352
390
|
fail LibDDWAF::Error, 'Could not create context'
|
353
391
|
end
|
@@ -360,9 +398,9 @@ module Datadog
|
|
360
398
|
def self.finalizer(context_obj, input_objs)
|
361
399
|
proc do |object_id|
|
362
400
|
input_objs.each do |input_obj|
|
363
|
-
Datadog::
|
401
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_object_free(input_obj)
|
364
402
|
end
|
365
|
-
Datadog::
|
403
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_context_destroy(context_obj)
|
366
404
|
end
|
367
405
|
end
|
368
406
|
|
@@ -371,19 +409,18 @@ module Datadog
|
|
371
409
|
ddwaf_err_internal: :err_internal,
|
372
410
|
ddwaf_err_invalid_object: :err_invalid_object,
|
373
411
|
ddwaf_err_invalid_argument: :err_invalid_argument,
|
374
|
-
ddwaf_err_timeout: :err_invalid_object,
|
375
412
|
ddwaf_good: :good,
|
376
413
|
ddwaf_monitor: :monitor,
|
377
414
|
ddwaf_block: :block,
|
378
415
|
}
|
379
416
|
|
380
417
|
def run(input, timeout = DEFAULT_TIMEOUT_US)
|
381
|
-
input_obj = Datadog::
|
418
|
+
input_obj = Datadog::AppSec::WAF.ruby_to_object(input)
|
382
419
|
if input_obj.null?
|
383
420
|
fail LibDDWAF::Error, "Could not convert input: #{input.inspect}"
|
384
421
|
end
|
385
422
|
|
386
|
-
result_obj = Datadog::
|
423
|
+
result_obj = Datadog::AppSec::WAF::LibDDWAF::Result.new
|
387
424
|
if result_obj.null?
|
388
425
|
fail LibDDWAF::Error, "Could not create result object"
|
389
426
|
end
|
@@ -391,18 +428,18 @@ module Datadog
|
|
391
428
|
# retain C objects in memory for subsequent calls to run
|
392
429
|
@input_objs << input_obj
|
393
430
|
|
394
|
-
code = Datadog::
|
431
|
+
code = Datadog::AppSec::WAF::LibDDWAF.ddwaf_run(@context_obj, input_obj, result_obj, timeout)
|
395
432
|
|
396
433
|
result = Result.new(
|
397
|
-
ACTION_MAP_OUT[
|
434
|
+
ACTION_MAP_OUT[code],
|
398
435
|
(JSON.parse(result_obj[:data]) if result_obj[:data] != nil),
|
399
|
-
|
400
|
-
result_obj[:
|
436
|
+
result_obj[:total_runtime],
|
437
|
+
result_obj[:timeout],
|
401
438
|
)
|
402
439
|
|
403
440
|
[ACTION_MAP_OUT[code], result]
|
404
441
|
ensure
|
405
|
-
Datadog::
|
442
|
+
Datadog::AppSec::WAF::LibDDWAF.ddwaf_result_free(result_obj) if result_obj
|
406
443
|
end
|
407
444
|
end
|
408
445
|
end
|
data/lib/libddwaf.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'datadog/
|
1
|
+
require 'datadog/appsec/waf'
|
data/vendor/libddwaf/{libddwaf-1.0.14-linux-aarch64 → libddwaf-1.2.1-linux-aarch64}/include/ddwaf.h
RENAMED
@@ -48,10 +48,9 @@ typedef enum
|
|
48
48
|
**/
|
49
49
|
typedef enum
|
50
50
|
{
|
51
|
-
DDWAF_ERR_INTERNAL = -
|
52
|
-
DDWAF_ERR_INVALID_OBJECT = -
|
53
|
-
DDWAF_ERR_INVALID_ARGUMENT = -
|
54
|
-
DDWAF_ERR_TIMEOUT = -1,
|
51
|
+
DDWAF_ERR_INTERNAL = -3,
|
52
|
+
DDWAF_ERR_INVALID_OBJECT = -2,
|
53
|
+
DDWAF_ERR_INVALID_ARGUMENT = -1,
|
55
54
|
DDWAF_GOOD = 0,
|
56
55
|
DDWAF_MONITOR = 1,
|
57
56
|
DDWAF_BLOCK = 2
|
@@ -72,13 +71,21 @@ typedef enum
|
|
72
71
|
DDWAF_LOG_OFF,
|
73
72
|
} DDWAF_LOG_LEVEL;
|
74
73
|
|
74
|
+
#ifdef __cplusplus
|
75
|
+
class PowerWAF;
|
76
|
+
class PWAdditive;
|
77
|
+
using ddwaf_handle = PowerWAF *;
|
78
|
+
using ddwaf_context = PWAdditive *;
|
79
|
+
#else
|
75
80
|
typedef struct _ddwaf_handle* ddwaf_handle;
|
76
81
|
typedef struct _ddwaf_context* ddwaf_context;
|
82
|
+
#endif
|
83
|
+
|
77
84
|
typedef struct _ddwaf_object ddwaf_object;
|
78
85
|
typedef struct _ddwaf_config ddwaf_config;
|
79
86
|
typedef struct _ddwaf_result ddwaf_result;
|
80
87
|
typedef struct _ddwaf_version ddwaf_version;
|
81
|
-
|
88
|
+
typedef struct _ddwaf_ruleset_info ddwaf_ruleset_info;
|
82
89
|
/**
|
83
90
|
* @struct ddwaf_object
|
84
91
|
*
|
@@ -94,7 +101,7 @@ struct _ddwaf_object
|
|
94
101
|
const char* stringValue;
|
95
102
|
uint64_t uintValue;
|
96
103
|
int64_t intValue;
|
97
|
-
|
104
|
+
ddwaf_object* array;
|
98
105
|
};
|
99
106
|
uint64_t nbEntries;
|
100
107
|
DDWAF_OBJ_TYPE type;
|
@@ -111,8 +118,6 @@ struct _ddwaf_config
|
|
111
118
|
uint64_t maxArrayLength;
|
112
119
|
/** Maximum depth of ddwaf::object maps. */
|
113
120
|
uint64_t maxMapDepth;
|
114
|
-
/** Maximum size of the rule run time store. **/
|
115
|
-
int32_t maxTimeStore;
|
116
121
|
};
|
117
122
|
|
118
123
|
/**
|
@@ -122,14 +127,12 @@ struct _ddwaf_config
|
|
122
127
|
**/
|
123
128
|
struct _ddwaf_result
|
124
129
|
{
|
125
|
-
/**
|
126
|
-
|
130
|
+
/** Whether there has been a timeout during the operation **/
|
131
|
+
bool timeout;
|
127
132
|
/** Run result in JSON format **/
|
128
133
|
const char* data;
|
129
|
-
/**
|
130
|
-
|
131
|
-
/** Total run time in microseconds **/
|
132
|
-
uint32_t perfTotalRuntime;
|
134
|
+
/** Total WAF runtime in nanoseconds **/
|
135
|
+
uint64_t total_runtime;
|
133
136
|
};
|
134
137
|
|
135
138
|
/**
|
@@ -144,6 +147,24 @@ struct _ddwaf_version
|
|
144
147
|
uint16_t patch;
|
145
148
|
};
|
146
149
|
|
150
|
+
/**
|
151
|
+
* @ddwaf_ruleset_info
|
152
|
+
*
|
153
|
+
* Structure containing diagnostics on the provided ruleset.
|
154
|
+
* */
|
155
|
+
struct _ddwaf_ruleset_info
|
156
|
+
{
|
157
|
+
/** Number of rules successfully loaded **/
|
158
|
+
uint16_t loaded;
|
159
|
+
/** Number of rules which failed to parse **/
|
160
|
+
uint16_t failed;
|
161
|
+
/** Map from an error string to an array of all the rule ids for which
|
162
|
+
* that error was raised. {error: [rule_ids]} **/
|
163
|
+
ddwaf_object errors;
|
164
|
+
/** Ruleset version **/
|
165
|
+
const char *version;
|
166
|
+
};
|
167
|
+
|
147
168
|
/**
|
148
169
|
* @typedef ddwaf_object_free_fn
|
149
170
|
*
|
@@ -174,10 +195,12 @@ typedef void (*ddwaf_log_cb)(
|
|
174
195
|
*
|
175
196
|
* @param rule ddwaf::object containing the patterns to be used by the WAF. (nonnull)
|
176
197
|
* @param config Optional configuration of the WAF. (nullable)
|
198
|
+
* @param info Optional ruleset parsing diagnostics. (nullable)
|
177
199
|
*
|
178
200
|
* @return Handle to the WAF instance.
|
179
201
|
**/
|
180
|
-
ddwaf_handle ddwaf_init(const ddwaf_object *rule,
|
202
|
+
ddwaf_handle ddwaf_init(const ddwaf_object *rule,
|
203
|
+
const ddwaf_config* config, ddwaf_ruleset_info *info);
|
181
204
|
|
182
205
|
/**
|
183
206
|
* ddwaf_destroy
|
@@ -187,7 +210,14 @@ ddwaf_handle ddwaf_init(const ddwaf_object *rule, const ddwaf_config* config);
|
|
187
210
|
* @param Handle to the WAF instance.
|
188
211
|
*/
|
189
212
|
void ddwaf_destroy(ddwaf_handle handle);
|
190
|
-
|
213
|
+
/**
|
214
|
+
* ddwaf_ruleset_info_free
|
215
|
+
*
|
216
|
+
* Free the memory associated with the ruleset info structure.
|
217
|
+
*
|
218
|
+
* @param info Ruleset info to free.
|
219
|
+
* */
|
220
|
+
void ddwaf_ruleset_info_free(ddwaf_ruleset_info *info);
|
191
221
|
/**
|
192
222
|
* ddwaf_required_addresses
|
193
223
|
*
|
@@ -248,7 +278,8 @@ ddwaf_context ddwaf_context_init(const ddwaf_handle handle, ddwaf_object_free_fn
|
|
248
278
|
* data is unknown. The result structure will not be
|
249
279
|
* filled if this error occurs.
|
250
280
|
**/
|
251
|
-
DDWAF_RET_CODE ddwaf_run(ddwaf_context context, ddwaf_object *data,
|
281
|
+
DDWAF_RET_CODE ddwaf_run(ddwaf_context context, ddwaf_object *data,
|
282
|
+
ddwaf_result *result, uint64_t timeout);
|
252
283
|
|
253
284
|
/**
|
254
285
|
* ddwaf_context_destroy
|
@@ -451,6 +482,101 @@ bool ddwaf_object_map_addl(ddwaf_object *map, const char *key, size_t length, dd
|
|
451
482
|
**/
|
452
483
|
bool ddwaf_object_map_addl_nc(ddwaf_object *map, const char *key, size_t length, ddwaf_object *object);
|
453
484
|
|
485
|
+
/**
|
486
|
+
* ddwaf_object_type
|
487
|
+
*
|
488
|
+
* Returns the type of the object.
|
489
|
+
*
|
490
|
+
* @param object The object from which to get the type.
|
491
|
+
*
|
492
|
+
* @return The object type of DDWAF_OBJ_INVALID if NULL.
|
493
|
+
**/
|
494
|
+
DDWAF_OBJ_TYPE ddwaf_object_type(ddwaf_object *object);
|
495
|
+
|
496
|
+
/**
|
497
|
+
* ddwaf_object_size
|
498
|
+
*
|
499
|
+
* Returns the size of the container object.
|
500
|
+
*
|
501
|
+
* @param object The object from which to get the size.
|
502
|
+
*
|
503
|
+
* @return The object size or 0 if the object is not a container (array, map).
|
504
|
+
**/
|
505
|
+
size_t ddwaf_object_size(ddwaf_object *object);
|
506
|
+
|
507
|
+
/**
|
508
|
+
* ddwaf_object_length
|
509
|
+
*
|
510
|
+
* Returns the length of the string object.
|
511
|
+
*
|
512
|
+
* @param object The object from which to get the length.
|
513
|
+
*
|
514
|
+
* @return The string length or 0 if the object is not a string.
|
515
|
+
**/
|
516
|
+
size_t ddwaf_object_length(ddwaf_object *object);
|
517
|
+
|
518
|
+
/**
|
519
|
+
* ddwaf_object_get_key
|
520
|
+
*
|
521
|
+
* Returns the key contained within the object.
|
522
|
+
*
|
523
|
+
* @param object The object from which to get the key.
|
524
|
+
* @param length Output parameter on which to return the length of the key,
|
525
|
+
* this parameter is optional / nullable.
|
526
|
+
*
|
527
|
+
* @return The key of the object or NULL if the object doesn't contain a key.
|
528
|
+
**/
|
529
|
+
const char* ddwaf_object_get_key(ddwaf_object *object, size_t *length);
|
530
|
+
|
531
|
+
/**
|
532
|
+
* ddwaf_object_get_string
|
533
|
+
*
|
534
|
+
* Returns the string contained within the object.
|
535
|
+
*
|
536
|
+
* @param object The object from which to get the string.
|
537
|
+
* @param length Output parameter on which to return the length of the string,
|
538
|
+
* this parameter is optional / nullable.
|
539
|
+
*
|
540
|
+
* @return The string of the object or NULL if the object is not a string.
|
541
|
+
**/
|
542
|
+
const char* ddwaf_object_get_string(ddwaf_object *object, size_t *length);
|
543
|
+
|
544
|
+
/**
|
545
|
+
* ddwaf_object_get_unsigned
|
546
|
+
*
|
547
|
+
* Returns the uint64 contained within the object.
|
548
|
+
*
|
549
|
+
* @param object The object from which to get the integer.
|
550
|
+
*
|
551
|
+
* @return The integer or 0 if the object is not an unsigned.
|
552
|
+
**/
|
553
|
+
uint64_t ddwaf_object_get_unsigned(ddwaf_object *object);
|
554
|
+
|
555
|
+
/**
|
556
|
+
* ddwaf_object_get_signed
|
557
|
+
*
|
558
|
+
* Returns the int64 contained within the object.
|
559
|
+
*
|
560
|
+
* @param object The object from which to get the integer.
|
561
|
+
*
|
562
|
+
* @return The integer or 0 if the object is not a signed.
|
563
|
+
**/
|
564
|
+
int64_t ddwaf_object_get_signed(ddwaf_object *object);
|
565
|
+
|
566
|
+
/**
|
567
|
+
* ddwaf_object_get_index
|
568
|
+
*
|
569
|
+
* Returns the object contained in the container at the given index.
|
570
|
+
*
|
571
|
+
* @param object The container from which to extract the object.
|
572
|
+
* @param index The position of the required object within the container.
|
573
|
+
*
|
574
|
+
* @return The requested object or NULL if the index is out of bounds or the
|
575
|
+
* object is not a container.
|
576
|
+
**/
|
577
|
+
ddwaf_object* ddwaf_object_get_index(ddwaf_object *object, size_t index);
|
578
|
+
|
579
|
+
|
454
580
|
/**
|
455
581
|
* ddwaf_object_free
|
456
582
|
*
|
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.2.1.0.0.beta1
|
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: 2022-
|
11
|
+
date: 2022-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -38,11 +38,11 @@ files:
|
|
38
38
|
- LICENSE.Apache
|
39
39
|
- LICENSE.BSD3
|
40
40
|
- NOTICE
|
41
|
-
- lib/datadog/
|
42
|
-
- lib/datadog/
|
41
|
+
- lib/datadog/appsec/waf.rb
|
42
|
+
- lib/datadog/appsec/waf/version.rb
|
43
43
|
- lib/libddwaf.rb
|
44
|
-
- vendor/libddwaf/libddwaf-1.
|
45
|
-
- vendor/libddwaf/libddwaf-1.
|
44
|
+
- vendor/libddwaf/libddwaf-1.2.1-linux-aarch64/include/ddwaf.h
|
45
|
+
- vendor/libddwaf/libddwaf-1.2.1-linux-aarch64/lib/libddwaf.so
|
46
46
|
homepage: https://github.com/DataDog/libddwaf
|
47
47
|
licenses:
|
48
48
|
- BSD-3-Clause
|
Binary file
|