libddwaf 1.8.2.0.0 → 1.9.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug.md +32 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- data/.gitignore +0 -1
- data/lib/datadog/appsec/waf/version.rb +2 -2
- data/lib/datadog/appsec/waf.rb +9 -4
- data/shell.nix +35 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd38633600d82ecc9166a86fe314f6704d9a0e18662989811d6a4031bf313647
|
4
|
+
data.tar.gz: aed657ca737793808c6400966b4a05c405ef16734e53d73e0eade264fa8d360d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2c774e31e97902a60296084de6304cfd6f8528fadf1013b73c8cbed52a538e4b20082c3f2e6085f16e32ca27d71b767cb2a1e8c01207c07776d991210faddc
|
7
|
+
data.tar.gz: 99446731f04d3fff037549cba900ea96eb904b3fc8f617b57c7d6b6ff8543d0d0903b3722c52df383362d972b0204b467d54e30b2a0b4e57aac30cae8d5ae7e9
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: File a bug report
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Current behaviour**
|
11
|
+
<!-- What is be happening. -->
|
12
|
+
|
13
|
+
**Expected behaviour**
|
14
|
+
<!-- What should be happening. -->
|
15
|
+
|
16
|
+
**Steps to reproduce**
|
17
|
+
<!--
|
18
|
+
How can we reproduce this issue in order to diagnose it?
|
19
|
+
Code snippets, log messages, screenshots and sample apps are encouraged!
|
20
|
+
-->
|
21
|
+
|
22
|
+
**How does `libddwaf` help you?**
|
23
|
+
<!-- Optionally, tell us why and how you're using ddtrace, and what your overall experience with it is! -->
|
24
|
+
|
25
|
+
**Environment**
|
26
|
+
|
27
|
+
* **libddwaf version:**
|
28
|
+
* **libddwaf gem platform:**
|
29
|
+
* **Ruby version:**
|
30
|
+
* **Ruby platform:**
|
31
|
+
* **Operating system:**
|
32
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
**What does this PR do?**
|
2
|
+
<!-- A brief description of the change being made with this pull request. -->
|
3
|
+
|
4
|
+
**Motivation**
|
5
|
+
<!-- What inspired you to submit this pull request? -->
|
6
|
+
|
7
|
+
**Additional Notes**
|
8
|
+
<!-- Anything else we should know when reviewing? -->
|
9
|
+
|
10
|
+
**How to test the change?**
|
11
|
+
<!--
|
12
|
+
Describe here how the change can be validated.
|
13
|
+
You are strongly encouraged to provide automated tests for this PR.
|
14
|
+
If this change cannot be feasibly tested, please explain why,
|
15
|
+
unless the change does not modify code (e.g. only modifies docs, comments).
|
16
|
+
-->
|
17
|
+
|
data/.gitignore
CHANGED
data/lib/datadog/appsec/waf.rb
CHANGED
@@ -4,6 +4,7 @@ require 'datadog/appsec/waf/version'
|
|
4
4
|
|
5
5
|
module Datadog
|
6
6
|
module AppSec
|
7
|
+
# rubocop:disable Metrics/ModuleLength
|
7
8
|
module WAF
|
8
9
|
module LibDDWAF
|
9
10
|
class Error < StandardError
|
@@ -281,9 +282,9 @@ module Datadog
|
|
281
282
|
|
282
283
|
attach_function :ddwaf_set_log_cb, [:ddwaf_log_cb, :ddwaf_log_level], :bool
|
283
284
|
|
284
|
-
DEFAULT_MAX_CONTAINER_SIZE =
|
285
|
-
DEFAULT_MAX_CONTAINER_DEPTH =
|
286
|
-
DEFAULT_MAX_STRING_LENGTH =
|
285
|
+
DEFAULT_MAX_CONTAINER_SIZE = 256
|
286
|
+
DEFAULT_MAX_CONTAINER_DEPTH = 20
|
287
|
+
DEFAULT_MAX_STRING_LENGTH = 16_384 # in bytes, UTF-8 worst case being 4x size in terms of code point)
|
287
288
|
|
288
289
|
DDWAF_MAX_CONTAINER_SIZE = 256
|
289
290
|
DDWAF_MAX_CONTAINER_DEPTH = 20
|
@@ -296,6 +297,7 @@ module Datadog
|
|
296
297
|
LibDDWAF.ddwaf_get_version
|
297
298
|
end
|
298
299
|
|
300
|
+
# rubocop:disable Metrics/MethodLength
|
299
301
|
def self.ruby_to_object(val, max_container_size: nil, max_container_depth: nil, max_string_length: nil, coerce: true)
|
300
302
|
case val
|
301
303
|
when Array
|
@@ -349,7 +351,8 @@ module Datadog
|
|
349
351
|
obj
|
350
352
|
when String
|
351
353
|
obj = LibDDWAF::Object.new
|
352
|
-
|
354
|
+
encoded_val = val.to_s.encode('utf-8', invalid: :replace, undef: :replace)
|
355
|
+
val = encoded_val[0, max_string_length] if max_string_length
|
353
356
|
str = val.to_s
|
354
357
|
res = LibDDWAF.ddwaf_object_stringl(obj, str, str.bytesize)
|
355
358
|
if res.null?
|
@@ -405,6 +408,7 @@ module Datadog
|
|
405
408
|
ruby_to_object(''.freeze)
|
406
409
|
end
|
407
410
|
end
|
411
|
+
# rubocop:enable Metrics/MethodLength
|
408
412
|
|
409
413
|
def self.object_to_ruby(obj)
|
410
414
|
case obj[:type]
|
@@ -699,5 +703,6 @@ module Datadog
|
|
699
703
|
end
|
700
704
|
end
|
701
705
|
end
|
706
|
+
# rubocop:enable Metrics/ModuleLength
|
702
707
|
end
|
703
708
|
end
|
data/shell.nix
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
# use the environment channel
|
3
|
+
pkgs ? import <nixpkgs> {},
|
4
|
+
|
5
|
+
# use a pinned package state
|
6
|
+
pinned ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/14d9b465c71.tar.gz")) {},
|
7
|
+
}:
|
8
|
+
let
|
9
|
+
# specify ruby version to use
|
10
|
+
ruby = pinned.ruby_3_1;
|
11
|
+
|
12
|
+
# control llvm/clang version (e.g for packages built form source)
|
13
|
+
llvm = pinned.llvmPackages_12;
|
14
|
+
in llvm.stdenv.mkDerivation {
|
15
|
+
# unique project name for this environment derivation
|
16
|
+
name = "libddwaf-rb.devshell";
|
17
|
+
|
18
|
+
buildInputs = [
|
19
|
+
ruby
|
20
|
+
];
|
21
|
+
|
22
|
+
shellHook = ''
|
23
|
+
# get major.minor.0 ruby version
|
24
|
+
export RUBY_VERSION="$(ruby -e 'puts RUBY_VERSION.gsub(/\d+$/, "0")')"
|
25
|
+
|
26
|
+
# make gem install work in-project, compatibly with bundler
|
27
|
+
export GEM_HOME="$(pwd)/vendor/bundle/ruby/$RUBY_VERSION"
|
28
|
+
|
29
|
+
# make bundle work in-project
|
30
|
+
export BUNDLE_PATH="$(pwd)/vendor/bundle"
|
31
|
+
|
32
|
+
# enable calling gem scripts without bundle exec
|
33
|
+
export PATH="$GEM_HOME/bin:$PATH"
|
34
|
+
'';
|
35
|
+
}
|
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.9.0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -33,6 +33,8 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
+
- ".github/ISSUE_TEMPLATE/bug.md"
|
37
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
36
38
|
- ".github/workflows/lint.yml"
|
37
39
|
- ".github/workflows/package.yml"
|
38
40
|
- ".github/workflows/test.yml"
|
@@ -50,6 +52,7 @@ files:
|
|
50
52
|
- lib/datadog/appsec/waf/version.rb
|
51
53
|
- lib/libddwaf.rb
|
52
54
|
- libddwaf.gemspec
|
55
|
+
- shell.nix
|
53
56
|
- sig/datadog/appsec/waf.rbs
|
54
57
|
- sig/datadog/appsec/waf/version.rbs
|
55
58
|
- sig/libddwaf.rbs
|