libddwaf 1.14.0.0.0 → 1.18.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/actions/docker-build-ruby/Dockerfile +5 -0
- data/.github/actions/docker-build-ruby/Dockerfile.alpine +7 -0
- data/.github/actions/docker-build-ruby/Dockerfile.jruby +6 -0
- data/.github/actions/docker-build-ruby/action.yml +57 -0
- data/.github/workflows/lint.yml +13 -12
- data/.github/workflows/package.yml +93 -174
- data/.github/workflows/test.yml +86 -190
- data/.gitignore +4 -1
- data/.steepignore +4 -0
- data/CHANGELOG.md +5 -1
- data/lib/datadog/appsec/waf/context.rb +122 -0
- data/lib/datadog/appsec/waf/converter.rb +172 -0
- data/lib/datadog/appsec/waf/handle.rb +108 -0
- data/lib/datadog/appsec/waf/lib_ddwaf.rb +307 -0
- data/lib/datadog/appsec/waf/result.rb +33 -0
- data/lib/datadog/appsec/waf/version.rb +2 -2
- data/lib/datadog/appsec/waf.rb +17 -670
- data/sig/datadog/appsec/waf/context.rbs +39 -0
- data/sig/datadog/appsec/waf/converter.rbs +11 -0
- data/sig/datadog/appsec/waf/handle.rbs +42 -0
- data/sig/datadog/appsec/waf/lib_ddwaf.rbs +156 -0
- data/sig/datadog/appsec/waf/result.rbs +33 -0
- data/sig/datadog/appsec/waf.rbs +1 -201
- metadata +22 -8
- data/vendor/rbs/ffi/0/ffi.rbs +0 -62
@@ -0,0 +1,39 @@
|
|
1
|
+
module Datadog
|
2
|
+
module AppSec
|
3
|
+
module WAF
|
4
|
+
class Context
|
5
|
+
@context_obj: ::FFI::Pointer
|
6
|
+
|
7
|
+
@valid: bool
|
8
|
+
|
9
|
+
@retained: Array[untyped]
|
10
|
+
|
11
|
+
RESULT_CODE: ::Hash[::Symbol, ::Symbol]
|
12
|
+
|
13
|
+
attr_reader context_obj: ::FFI::Pointer
|
14
|
+
|
15
|
+
def initialize: (Handle handle) -> void
|
16
|
+
|
17
|
+
def finalize: () -> void
|
18
|
+
|
19
|
+
def run: (WAF::data persistent_data, WAF::data ephemeral_data, ?::Integer timeout) -> ::Array[top]
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def validate!: () -> void
|
24
|
+
|
25
|
+
def invalidate!: () -> void
|
26
|
+
|
27
|
+
def valid?: () -> bool?
|
28
|
+
|
29
|
+
def valid!: () -> void
|
30
|
+
|
31
|
+
def retained: () -> Array[untyped]
|
32
|
+
|
33
|
+
def retain: (top object) -> void
|
34
|
+
|
35
|
+
def release: (top object) -> void
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Datadog
|
2
|
+
module AppSec
|
3
|
+
module WAF
|
4
|
+
module Converter
|
5
|
+
def self.ruby_to_object: (top val, ?max_container_size: ::Integer?, ?max_container_depth: ::Integer?, ?max_string_length: ::Integer?, ?coerce: bool?) -> LibDDWAF::Object
|
6
|
+
|
7
|
+
def self.object_to_ruby: (LibDDWAF::Object obj) -> WAF::data
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Datadog
|
2
|
+
module AppSec
|
3
|
+
module WAF
|
4
|
+
class Handle
|
5
|
+
@config: LibDDWAF::Config
|
6
|
+
|
7
|
+
@handle_obj: ::FFI::Pointer
|
8
|
+
|
9
|
+
@diagnostics: WAF::data
|
10
|
+
|
11
|
+
@valid: bool
|
12
|
+
|
13
|
+
attr_reader handle_obj: ::FFI::Pointer
|
14
|
+
|
15
|
+
attr_reader diagnostics: WAF::data
|
16
|
+
|
17
|
+
attr_reader config: LibDDWAF::Config
|
18
|
+
|
19
|
+
def initialize: (data rule, ?limits: ::Hash[::Symbol, ::Integer], ?obfuscator: ::Hash[::Symbol, ::String]) -> void
|
20
|
+
|
21
|
+
def finalize: () -> void
|
22
|
+
|
23
|
+
def required_addresses: () -> ::Array[::String?]
|
24
|
+
|
25
|
+
# TODO: WAF::data
|
26
|
+
def merge: (untyped data) -> Handle?
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def new_from_handle: (::FFI::Pointer handle_object, data diagnostics, WAF::LibDDWAF::Config config) -> Handle
|
31
|
+
|
32
|
+
def validate!: () -> void
|
33
|
+
|
34
|
+
def invalidate!: () -> void
|
35
|
+
|
36
|
+
def valid?: () -> bool?
|
37
|
+
|
38
|
+
def valid!: () -> void
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
module Datadog
|
2
|
+
module AppSec
|
3
|
+
module WAF
|
4
|
+
module LibDDWAF
|
5
|
+
class Error < StandardError
|
6
|
+
attr_reader diagnostics: WAF::data
|
7
|
+
|
8
|
+
def initialize: (::String msg, ?diagnostics: WAF::data?) -> void
|
9
|
+
end
|
10
|
+
|
11
|
+
extend ::FFI::Library
|
12
|
+
|
13
|
+
def self.typedef: [T < ::FFI::Type, N, R, C] (T old, Symbol | ::FFI::DataConverter[N, R, C] add, ?untyped) -> T
|
14
|
+
| (Symbol old, Symbol add, ?untyped) -> (::FFI::Type | ::FFI::Enum)
|
15
|
+
| [X < ::FFI::DataConverter[N, R, C], N, R, C] (X old, Symbol add, ?untyped) -> ::FFI::Type::Mapped[X, N, R, C]
|
16
|
+
| (:enum old, Array[Symbol | Integer] add, ?untyped) -> ::FFI::Enum
|
17
|
+
| (:enum old, Symbol | ::FFI::Type add, Array[Symbol | Integer] info) -> ::FFI::Enum
|
18
|
+
| (untyped, ::Symbol) -> void
|
19
|
+
|
20
|
+
def self.callback: (::Symbol name, Array[::FFI::Library::ffi_lib_type] params, ::FFI::Library::ffi_lib_type ret) -> ::FFI::CallbackInfo
|
21
|
+
|
22
|
+
def self.enum: (*(Symbol | Integer) args) -> ::FFI::Enum
|
23
|
+
| (Array[Symbol | Integer] values) -> ::FFI::Enum
|
24
|
+
|
25
|
+
def self.local_os: () -> ::String
|
26
|
+
def self.local_cpu: () -> ::String
|
27
|
+
def self.local_version: () -> (::String | nil)
|
28
|
+
def self.source_dir: () -> ::String
|
29
|
+
def self.vendor_dir: () -> ::String
|
30
|
+
def self.libddwaf_vendor_dir: () -> ::String
|
31
|
+
def self.shared_lib_triplet: (?version: ::String?) -> ::String
|
32
|
+
def self.libddwaf_dir: () -> ::String
|
33
|
+
def self.shared_lib_extname: () -> ::String
|
34
|
+
def self.shared_lib_path: () -> ::String
|
35
|
+
|
36
|
+
# version
|
37
|
+
|
38
|
+
def self.ddwaf_get_version: () -> ::String
|
39
|
+
|
40
|
+
# ddwaf::object data structure
|
41
|
+
|
42
|
+
DDWAF_OBJ_TYPE: ::FFI::Enum
|
43
|
+
|
44
|
+
class UInt32Ptr < ::FFI::Struct[::FFI::AbstractMemory, ::Integer]
|
45
|
+
end
|
46
|
+
|
47
|
+
class UInt64Ptr < ::FFI::Struct[::FFI::AbstractMemory, ::Integer]
|
48
|
+
end
|
49
|
+
|
50
|
+
class SizeTPtr < ::FFI::Struct[::FFI::AbstractMemory, ::Integer]
|
51
|
+
end
|
52
|
+
|
53
|
+
class ObjectValueUnion < ::FFI::Union[::FFI::AbstractMemory, untyped]
|
54
|
+
end
|
55
|
+
|
56
|
+
class Object < ::FFI::Struct[::FFI::AbstractMemory, untyped]
|
57
|
+
end
|
58
|
+
|
59
|
+
# setters
|
60
|
+
|
61
|
+
def self.ddwaf_object_invalid: (LibDDWAF::Object) -> ::FFI::Pointer
|
62
|
+
def self.ddwaf_object_string: (LibDDWAF::Object, ::String) -> ::FFI::Pointer
|
63
|
+
def self.ddwaf_object_stringl: (LibDDWAF::Object, ::String, ::Integer) -> ::FFI::Pointer
|
64
|
+
def self.ddwaf_object_stringl_nc: (LibDDWAF::Object, ::String, ::Integer) -> ::FFI::Pointer
|
65
|
+
def self.ddwaf_object_unsigned: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
66
|
+
def self.ddwaf_object_signed: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
67
|
+
def self.ddwaf_object_string_from_unsigned: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
68
|
+
def self.ddwaf_object_string_from_signed: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
69
|
+
def self.ddwaf_object_bool: (LibDDWAF::Object, bool) -> ::FFI::Pointer
|
70
|
+
def self.ddwaf_object_float: (LibDDWAF::Object, ::Float) -> ::FFI::Pointer
|
71
|
+
def self.ddwaf_object_null: (LibDDWAF::Object) -> ::FFI::Pointer
|
72
|
+
|
73
|
+
def self.ddwaf_object_array: (LibDDWAF::Object) -> ::FFI::Pointer
|
74
|
+
def self.ddwaf_object_array_add: (LibDDWAF::Object, LibDDWAF::Object) -> bool
|
75
|
+
|
76
|
+
def self.ddwaf_object_map: (LibDDWAF::Object) -> ::FFI::Pointer
|
77
|
+
def self.ddwaf_object_map_add: (LibDDWAF::Object, ::String, LibDDWAF::Object) -> bool
|
78
|
+
def self.ddwaf_object_map_addl: (LibDDWAF::Object, ::String, ::Integer, LibDDWAF::Object) -> bool
|
79
|
+
def self.ddwaf_object_map_addl_nc: (LibDDWAF::Object, ::String, ::Integer, LibDDWAF::Object) -> bool
|
80
|
+
|
81
|
+
# getters
|
82
|
+
|
83
|
+
def self.ddwaf_object_type: (LibDDWAF::Object) -> ::FFI::Enum
|
84
|
+
def self.ddwaf_object_size: (LibDDWAF::Object) -> ::Integer
|
85
|
+
def self.ddwaf_object_length: (LibDDWAF::Object) -> ::Integer
|
86
|
+
def self.ddwaf_object_get_key: (LibDDWAF::Object, SizeTPtr) -> ::String
|
87
|
+
def self.ddwaf_object_get_string: (LibDDWAF::Object, SizeTPtr) -> ::String
|
88
|
+
def self.ddwaf_object_get_unsigned: (LibDDWAF::Object, SizeTPtr) -> ::Integer
|
89
|
+
def self.ddwaf_object_get_signed: (LibDDWAF::Object, SizeTPtr) -> ::Integer
|
90
|
+
def self.ddwaf_object_get_index: (LibDDWAF::Object, ::Integer) -> LibDDWAF::Object
|
91
|
+
def self.ddwaf_object_get_bool: (LibDDWAF::Object) -> bool
|
92
|
+
def self.ddwaf_object_get_float: (LibDDWAF::Object) -> ::Float
|
93
|
+
|
94
|
+
# freeers
|
95
|
+
|
96
|
+
def self.ddwaf_object_free: (LibDDWAF::Object) -> void
|
97
|
+
|
98
|
+
ObjectFree: ::FFI::Function
|
99
|
+
ObjectNoFree: ::FFI::Pointer
|
100
|
+
|
101
|
+
# main handle
|
102
|
+
|
103
|
+
class Config < ::FFI::Struct[::FFI::AbstractMemory, untyped]
|
104
|
+
class Limits < ::FFI::Struct[::FFI::AbstractMemory, ::Integer]
|
105
|
+
end
|
106
|
+
|
107
|
+
class Obfuscator < ::FFI::Struct[::FFI::AbstractMemory, ::FFI::Pointer]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.ddwaf_init: (top, Config, Object) -> ::FFI::Pointer
|
112
|
+
def self.ddwaf_update: (::FFI::Pointer, LibDDWAF::Object, LibDDWAF::Object) -> ::FFI::Pointer
|
113
|
+
def self.ddwaf_destroy: (::FFI::Pointer) -> void
|
114
|
+
|
115
|
+
def self.ddwaf_known_addresses: (::FFI::Pointer, UInt32Ptr) -> ::FFI::Pointer
|
116
|
+
def self.ddwaf_rule_data_ids: (::FFI::Pointer, UInt32Ptr) -> ::FFI::Pointer
|
117
|
+
|
118
|
+
# updating
|
119
|
+
|
120
|
+
DDWAF_RET_CODE: ::FFI::Enum
|
121
|
+
|
122
|
+
# running
|
123
|
+
|
124
|
+
def self.ddwaf_context_init: (::FFI::Pointer) -> ::FFI::Pointer
|
125
|
+
def self.ddwaf_context_destroy: (::FFI::Pointer) -> void
|
126
|
+
|
127
|
+
class Result < ::FFI::Struct[::FFI::AbstractMemory, untyped]
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.ddwaf_run: (::FFI::Pointer, Object, Object, Result, ::Integer) -> ::Symbol
|
131
|
+
def self.ddwaf_result_free: (Result) -> void
|
132
|
+
|
133
|
+
# logging
|
134
|
+
|
135
|
+
DDWAF_LOG_LEVEL: ::FFI::Enum
|
136
|
+
|
137
|
+
type ddwaf_log_level = ::Symbol
|
138
|
+
|
139
|
+
# TODO: signature is as below but steep 1.1 does not yet support method/proc/block mapping
|
140
|
+
# type ddwaf_log_cb = ^(ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
|
141
|
+
type ddwaf_log_cb = ::Method | ::Proc
|
142
|
+
def self.ddwaf_set_log_cb: (ddwaf_log_cb, ddwaf_log_level) -> bool
|
143
|
+
|
144
|
+
DEFAULT_MAX_CONTAINER_SIZE: ::Integer
|
145
|
+
DEFAULT_MAX_CONTAINER_DEPTH: ::Integer
|
146
|
+
DEFAULT_MAX_STRING_LENGTH: ::Integer
|
147
|
+
|
148
|
+
DDWAF_MAX_CONTAINER_SIZE: ::Integer
|
149
|
+
DDWAF_MAX_CONTAINER_DEPTH: ::Integer
|
150
|
+
DDWAF_MAX_STRING_LENGTH: ::Integer
|
151
|
+
|
152
|
+
DDWAF_RUN_TIMEOUT: ::Integer
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Datadog
|
2
|
+
module AppSec
|
3
|
+
module WAF
|
4
|
+
class Result
|
5
|
+
@status: ::Symbol
|
6
|
+
|
7
|
+
@events: WAF::data
|
8
|
+
|
9
|
+
@total_runtime: ::Float
|
10
|
+
|
11
|
+
@timeout: bool
|
12
|
+
|
13
|
+
@actions: WAF::data
|
14
|
+
|
15
|
+
@derivatives: WAF::data
|
16
|
+
|
17
|
+
attr_reader status: ::Symbol
|
18
|
+
|
19
|
+
attr_reader events: WAF::data
|
20
|
+
|
21
|
+
attr_reader total_runtime: ::Float
|
22
|
+
|
23
|
+
attr_reader timeout: bool
|
24
|
+
|
25
|
+
attr_reader actions: WAF::data
|
26
|
+
|
27
|
+
attr_reader derivatives: WAF::data
|
28
|
+
|
29
|
+
def initialize: (::Symbol status, WAF::data events, ::Float total_runtime, bool timeout, WAF::data actions, WAF::data derivatives) -> void
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/sig/datadog/appsec/waf.rbs
CHANGED
@@ -1,151 +1,9 @@
|
|
1
1
|
module Datadog
|
2
2
|
module AppSec
|
3
3
|
module WAF
|
4
|
-
module LibDDWAF
|
5
|
-
class Error < StandardError
|
6
|
-
attr_reader diagnostics: ::Datadog::AppSec::WAF::data
|
7
|
-
|
8
|
-
def initialize: (::String msg, ?diagnostics: ::Datadog::AppSec::WAF::data?) -> void
|
9
|
-
end
|
10
|
-
|
11
|
-
extend ::FFI::Library
|
12
|
-
|
13
|
-
def self.local_os: () -> ::String
|
14
|
-
def self.local_cpu: () -> ::String
|
15
|
-
def self.local_version: () -> (::String | nil)
|
16
|
-
def self.source_dir: () -> ::String
|
17
|
-
def self.vendor_dir: () -> ::String
|
18
|
-
def self.libddwaf_vendor_dir: () -> ::String
|
19
|
-
def self.shared_lib_triplet: (?version: ::String?) -> ::String
|
20
|
-
def self.libddwaf_dir: () -> ::String
|
21
|
-
def self.shared_lib_extname: () -> ::String
|
22
|
-
def self.shared_lib_path: () -> ::String
|
23
|
-
|
24
|
-
# version
|
25
|
-
|
26
|
-
def self.ddwaf_get_version: () -> ::String
|
27
|
-
|
28
|
-
# ddwaf::object data structure
|
29
|
-
|
30
|
-
DDWAF_OBJ_TYPE: ::FFI::Enum
|
31
|
-
|
32
|
-
class UInt32Ptr < ::FFI::Struct
|
33
|
-
end
|
34
|
-
|
35
|
-
class UInt64Ptr < ::FFI::Struct
|
36
|
-
end
|
37
|
-
|
38
|
-
class SizeTPtr < ::FFI::Struct
|
39
|
-
end
|
40
|
-
|
41
|
-
class ObjectValueUnion < ::FFI::Union
|
42
|
-
end
|
43
|
-
|
44
|
-
class Object < ::FFI::Struct
|
45
|
-
end
|
46
|
-
|
47
|
-
# setters
|
48
|
-
|
49
|
-
def self.ddwaf_object_invalid: (LibDDWAF::Object) -> ::FFI::Pointer
|
50
|
-
def self.ddwaf_object_string: (LibDDWAF::Object, ::String) -> ::FFI::Pointer
|
51
|
-
def self.ddwaf_object_stringl: (LibDDWAF::Object, ::String, ::Integer) -> ::FFI::Pointer
|
52
|
-
def self.ddwaf_object_stringl_nc: (LibDDWAF::Object, ::String, ::Integer) -> ::FFI::Pointer
|
53
|
-
def self.ddwaf_object_unsigned: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
54
|
-
def self.ddwaf_object_signed: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
55
|
-
def self.ddwaf_object_string_from_unsigned: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
56
|
-
def self.ddwaf_object_string_from_signed: (LibDDWAF::Object, ::Integer) -> ::FFI::Pointer
|
57
|
-
def self.ddwaf_object_bool: (LibDDWAF::Object, bool) -> ::FFI::Pointer
|
58
|
-
def self.ddwaf_object_float: (LibDDWAF::Object, ::Float) -> ::FFI::Pointer
|
59
|
-
def self.ddwaf_object_null: (LibDDWAF::Object) -> ::FFI::Pointer
|
60
|
-
|
61
|
-
def self.ddwaf_object_array: (LibDDWAF::Object) -> ::FFI::Pointer
|
62
|
-
def self.ddwaf_object_array_add: (LibDDWAF::Object, LibDDWAF::Object) -> bool
|
63
|
-
|
64
|
-
def self.ddwaf_object_map: (LibDDWAF::Object) -> ::FFI::Pointer
|
65
|
-
def self.ddwaf_object_map_add: (LibDDWAF::Object, ::String, LibDDWAF::Object) -> bool
|
66
|
-
def self.ddwaf_object_map_addl: (LibDDWAF::Object, ::String, ::Integer, LibDDWAF::Object) -> bool
|
67
|
-
def self.ddwaf_object_map_addl_nc: (LibDDWAF::Object, ::String, ::Integer, LibDDWAF::Object) -> bool
|
68
|
-
|
69
|
-
# getters
|
70
|
-
|
71
|
-
def self.ddwaf_object_type: (LibDDWAF::Object) -> ::FFI::Enum
|
72
|
-
def self.ddwaf_object_size: (LibDDWAF::Object) -> ::Integer
|
73
|
-
def self.ddwaf_object_length: (LibDDWAF::Object) -> ::Integer
|
74
|
-
def self.ddwaf_object_get_key: (LibDDWAF::Object, SizeTPtr) -> ::String
|
75
|
-
def self.ddwaf_object_get_string: (LibDDWAF::Object, SizeTPtr) -> ::String
|
76
|
-
def self.ddwaf_object_get_unsigned: (LibDDWAF::Object, SizeTPtr) -> ::Integer
|
77
|
-
def self.ddwaf_object_get_signed: (LibDDWAF::Object, SizeTPtr) -> ::Integer
|
78
|
-
def self.ddwaf_object_get_index: (LibDDWAF::Object, ::Integer) -> LibDDWAF::Object
|
79
|
-
def self.ddwaf_object_get_bool: (LibDDWAF::Object) -> bool
|
80
|
-
def self.ddwaf_object_get_float: (LibDDWAF::Object) -> ::Float
|
81
|
-
|
82
|
-
# freeers
|
83
|
-
|
84
|
-
def self.ddwaf_object_free: (LibDDWAF::Object) -> void
|
85
|
-
|
86
|
-
ObjectFree: ::FFI::Function
|
87
|
-
ObjectNoFree: ::FFI::Pointer
|
88
|
-
|
89
|
-
# main handle
|
90
|
-
|
91
|
-
class Config < ::FFI::Struct
|
92
|
-
class Limits < ::FFI::Struct
|
93
|
-
end
|
94
|
-
|
95
|
-
class Obfuscator < ::FFI::Struct
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.ddwaf_init: (top, Config, Object) -> ::FFI::Pointer
|
100
|
-
def self.ddwaf_update: (::FFI::Pointer, LibDDWAF::Object, LibDDWAF::Object) -> ::FFI::Pointer
|
101
|
-
def self.ddwaf_destroy: (::FFI::Pointer) -> void
|
102
|
-
|
103
|
-
def self.ddwaf_required_addresses: (::FFI::Pointer, UInt32Ptr) -> ::FFI::Pointer
|
104
|
-
def self.ddwaf_rule_data_ids: (::FFI::Pointer, UInt32Ptr) -> ::FFI::Pointer
|
105
|
-
|
106
|
-
# updating
|
107
|
-
|
108
|
-
DDWAF_RET_CODE: ::FFI::Enum
|
109
|
-
|
110
|
-
# running
|
111
|
-
|
112
|
-
def self.ddwaf_context_init: (::FFI::Pointer) -> ::FFI::Pointer
|
113
|
-
def self.ddwaf_context_destroy: (::FFI::Pointer) -> void
|
114
|
-
|
115
|
-
class Result < ::FFI::Struct
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.ddwaf_run: (::FFI::Pointer, Object, Result, ::Integer) -> ::Symbol
|
119
|
-
def self.ddwaf_result_free: (Result) -> void
|
120
|
-
|
121
|
-
# logging
|
122
|
-
|
123
|
-
DDWAF_LOG_LEVEL: ::FFI::Enum
|
124
|
-
|
125
|
-
type ddwaf_log_level = ::Symbol
|
126
|
-
|
127
|
-
# TODO: signature is as below but steep 1.1 does not yet support method/proc/block mapping
|
128
|
-
# type ddwaf_log_cb = ^(ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
|
129
|
-
type ddwaf_log_cb = ::Method | ::Proc
|
130
|
-
def self.ddwaf_set_log_cb: (ddwaf_log_cb, ddwaf_log_level) -> bool
|
131
|
-
|
132
|
-
DEFAULT_MAX_CONTAINER_SIZE: ::Integer
|
133
|
-
DEFAULT_MAX_CONTAINER_DEPTH: ::Integer
|
134
|
-
DEFAULT_MAX_STRING_LENGTH: ::Integer
|
135
|
-
|
136
|
-
DDWAF_MAX_CONTAINER_SIZE: ::Integer
|
137
|
-
DDWAF_MAX_CONTAINER_DEPTH: ::Integer
|
138
|
-
DDWAF_MAX_STRING_LENGTH: ::Integer
|
139
|
-
|
140
|
-
DDWAF_RUN_TIMEOUT: ::Integer
|
141
|
-
end
|
142
|
-
|
143
|
-
def self.version: () -> ::String
|
144
|
-
|
145
4
|
type data = String | Symbol | Integer | Float | TrueClass | FalseClass | Array[data] | Hash[(String | Symbol | nil), data] | nil
|
146
5
|
|
147
|
-
def self.
|
148
|
-
def self.object_to_ruby: (::Datadog::AppSec::WAF::LibDDWAF::Object obj) -> data
|
6
|
+
def self.version: () -> ::String
|
149
7
|
|
150
8
|
self.@logger: ::Logger
|
151
9
|
self.@log_callback: LibDDWAF::ddwaf_log_cb
|
@@ -153,64 +11,6 @@ module Datadog
|
|
153
11
|
def self.log_callback: (LibDDWAF::ddwaf_log_level, ::String, ::String, ::Integer, ::FFI::Pointer, ::Integer) -> void
|
154
12
|
def self.logger: () -> ::Logger
|
155
13
|
def self.logger=: (::Logger logger) -> void
|
156
|
-
|
157
|
-
RESULT_CODE: ::Hash[::Symbol, ::Symbol]
|
158
|
-
|
159
|
-
class Handle
|
160
|
-
attr_reader handle_obj: ::FFI::Pointer
|
161
|
-
attr_reader diagnostics: data
|
162
|
-
attr_reader config: WAF::LibDDWAF::Config
|
163
|
-
|
164
|
-
def initialize: (data rule, ?limits: ::Hash[::Symbol, ::Integer], ?obfuscator: ::Hash[::Symbol, ::String]) -> void
|
165
|
-
def finalize: () -> untyped
|
166
|
-
def required_addresses: () -> ::Array[::String]
|
167
|
-
def merge: (untyped data) -> Handle?
|
168
|
-
|
169
|
-
private
|
170
|
-
|
171
|
-
@valid: bool
|
172
|
-
|
173
|
-
def new_from_handle: (::FFI::Pointer handle_object, data diagnostics, WAF::LibDDWAF::Config config) -> untyped
|
174
|
-
def validate!: () -> void
|
175
|
-
def invalidate!: () -> void
|
176
|
-
def valid?: () -> (nil | bool)
|
177
|
-
def valid!: () -> void
|
178
|
-
end
|
179
|
-
|
180
|
-
class Result
|
181
|
-
attr_reader status: ::Symbol
|
182
|
-
attr_reader events: data
|
183
|
-
attr_reader total_runtime: ::Float
|
184
|
-
attr_reader timeout: bool
|
185
|
-
attr_reader actions: data
|
186
|
-
attr_reader derivatives: data
|
187
|
-
|
188
|
-
def initialize: (::Symbol, data, ::Float, bool, data, data) -> void
|
189
|
-
end
|
190
|
-
|
191
|
-
class Context
|
192
|
-
attr_reader context_obj: ::FFI::Pointer
|
193
|
-
|
194
|
-
def initialize: (Handle handle) -> void
|
195
|
-
def finalize: () -> void
|
196
|
-
|
197
|
-
def run: (data input, ?::Integer timeout) -> ::Array[top]
|
198
|
-
|
199
|
-
private
|
200
|
-
|
201
|
-
@valid: bool
|
202
|
-
|
203
|
-
def validate!: () -> void
|
204
|
-
def invalidate!: () -> void
|
205
|
-
def valid?: () -> (nil | bool)
|
206
|
-
def valid!: () -> void
|
207
|
-
|
208
|
-
@retained: Array[untyped]
|
209
|
-
|
210
|
-
def retained: () -> Array[untyped]
|
211
|
-
def retain: (top object) -> void
|
212
|
-
def release: (top object) -> void
|
213
|
-
end
|
214
14
|
end
|
215
15
|
end
|
216
16
|
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.
|
4
|
+
version: 1.18.0.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -35,10 +35,15 @@ extra_rdoc_files: []
|
|
35
35
|
files:
|
36
36
|
- ".github/ISSUE_TEMPLATE/bug.md"
|
37
37
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
38
|
+
- ".github/actions/docker-build-ruby/Dockerfile"
|
39
|
+
- ".github/actions/docker-build-ruby/Dockerfile.alpine"
|
40
|
+
- ".github/actions/docker-build-ruby/Dockerfile.jruby"
|
41
|
+
- ".github/actions/docker-build-ruby/action.yml"
|
38
42
|
- ".github/workflows/lint.yml"
|
39
43
|
- ".github/workflows/package.yml"
|
40
44
|
- ".github/workflows/test.yml"
|
41
45
|
- ".gitignore"
|
46
|
+
- ".steepignore"
|
42
47
|
- CHANGELOG.md
|
43
48
|
- CONTRIBUTING.md
|
44
49
|
- LICENSE
|
@@ -49,14 +54,23 @@ files:
|
|
49
54
|
- README.md
|
50
55
|
- Steepfile
|
51
56
|
- lib/datadog/appsec/waf.rb
|
57
|
+
- lib/datadog/appsec/waf/context.rb
|
58
|
+
- lib/datadog/appsec/waf/converter.rb
|
59
|
+
- lib/datadog/appsec/waf/handle.rb
|
60
|
+
- lib/datadog/appsec/waf/lib_ddwaf.rb
|
61
|
+
- lib/datadog/appsec/waf/result.rb
|
52
62
|
- lib/datadog/appsec/waf/version.rb
|
53
63
|
- lib/libddwaf.rb
|
54
64
|
- libddwaf.gemspec
|
55
65
|
- shell.nix
|
56
66
|
- sig/datadog/appsec/waf.rbs
|
67
|
+
- sig/datadog/appsec/waf/context.rbs
|
68
|
+
- sig/datadog/appsec/waf/converter.rbs
|
69
|
+
- sig/datadog/appsec/waf/handle.rbs
|
70
|
+
- sig/datadog/appsec/waf/lib_ddwaf.rbs
|
71
|
+
- sig/datadog/appsec/waf/result.rbs
|
57
72
|
- sig/datadog/appsec/waf/version.rbs
|
58
73
|
- sig/libddwaf.rbs
|
59
|
-
- vendor/rbs/ffi/0/ffi.rbs
|
60
74
|
- vendor/rbs/gem/0/gem.rbs
|
61
75
|
- vendor/rbs/jruby/0/jruby.rbs
|
62
76
|
homepage: https://github.com/DataDog/libddwaf-rb
|
@@ -64,7 +78,7 @@ licenses:
|
|
64
78
|
- BSD-3-Clause
|
65
79
|
metadata:
|
66
80
|
allowed_push_host: https://rubygems.org
|
67
|
-
post_install_message:
|
81
|
+
post_install_message:
|
68
82
|
rdoc_options: []
|
69
83
|
require_paths:
|
70
84
|
- lib
|
@@ -72,15 +86,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2.
|
89
|
+
version: '2.5'
|
76
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
91
|
requirements:
|
78
92
|
- - ">="
|
79
93
|
- !ruby/object:Gem::Version
|
80
94
|
version: 2.0.0
|
81
95
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
83
|
-
signing_key:
|
96
|
+
rubygems_version: 3.5.17
|
97
|
+
signing_key:
|
84
98
|
specification_version: 4
|
85
99
|
summary: Datadog WAF
|
86
100
|
test_files: []
|
data/vendor/rbs/ffi/0/ffi.rbs
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
module FFI
|
2
|
-
module Type
|
3
|
-
class Builtin
|
4
|
-
end
|
5
|
-
|
6
|
-
class Mapped
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class AbstractMemory
|
11
|
-
def get_array_of_string: (::Integer, ::Integer) -> Array[String]
|
12
|
-
def read_bytes: (::Integer) -> ::String
|
13
|
-
end
|
14
|
-
|
15
|
-
class Pointer < AbstractMemory
|
16
|
-
NULL: Pointer
|
17
|
-
|
18
|
-
def null?: () -> bool
|
19
|
-
end
|
20
|
-
|
21
|
-
class MemoryPointer < Pointer
|
22
|
-
def self.from_string: (::String) -> MemoryPointer
|
23
|
-
end
|
24
|
-
|
25
|
-
class Enum
|
26
|
-
end
|
27
|
-
|
28
|
-
class Union
|
29
|
-
def self.layout: (*(Symbol | Integer)) -> void
|
30
|
-
end
|
31
|
-
|
32
|
-
type union = top # TODO: handle user-defined unions
|
33
|
-
|
34
|
-
class Struct
|
35
|
-
# TODO: layout args are actually "Symbol | Union, Integer, *(Symbol | Union, Integer)"
|
36
|
-
def self.layout: (*(Symbol | Integer | union)) -> void
|
37
|
-
def self.by_ref: () -> Type::Mapped
|
38
|
-
def self.size: () -> Integer
|
39
|
-
|
40
|
-
def null?: () -> bool
|
41
|
-
def initialize: (?Pointer) -> void
|
42
|
-
def []: (Symbol) -> untyped
|
43
|
-
def []=: (Symbol, untyped) -> untyped
|
44
|
-
def pointer: () -> Pointer
|
45
|
-
end
|
46
|
-
|
47
|
-
class Function < Pointer
|
48
|
-
end
|
49
|
-
|
50
|
-
module Library
|
51
|
-
# these can be worked around by typedef'ing to a Symbol
|
52
|
-
type enum = top # TODO: handle user-defined enum constants
|
53
|
-
type ref = top # TODO: handle by_ref references
|
54
|
-
type typedef = top # TODO: handle non-builtin types
|
55
|
-
|
56
|
-
def ffi_lib: (Array[String]) -> void
|
57
|
-
def typedef: (ref | Symbol, Symbol) -> (Type::Builtin | Type::Mapped | typedef)
|
58
|
-
def attach_function: (Symbol, Array[Symbol | Struct | enum], Symbol | Enum, ?blocking: bool) -> Function
|
59
|
-
def callback: (Symbol, Array[Symbol | Enum | Struct], Symbol | Enum) -> Function
|
60
|
-
def enum: (*untyped) -> Enum
|
61
|
-
end
|
62
|
-
end
|