fluent-plugin-redaction 0.1.1 → 0.1.3
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 +5 -5
- data/.github/workflows/build.yml +25 -0
- data/.github/workflows/publish.yml +32 -0
- data/README.md +3 -3
- data/VERSION +1 -1
- data/lib/fluent/plugin/filter_redaction.rb +2 -2
- data/test/plugin/test_filter_redaction.rb +18 -1
- metadata +6 -8
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4aefa5c2167ec270b54ccdcf4fb578ffa447682e07184a6a3a76981afa3b6b72
|
4
|
+
data.tar.gz: e9fba479837d46c34beecdaad2843a1213255bdc915eb11b43b736347fb04bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '00754936e2ede674066c2feb7dd31fb18d68550b2b51f363e2be55309b2e5eca366a7f48c063105cf765e09fc01107ecb002a0829d1a2cb40f9b84f29df48b54'
|
7
|
+
data.tar.gz: bf67b889c7c4f0c116faf918df719263adfe8a8493cf7c13fb6073c21838668a211622676b5ec1dcd218f427e15ad70b3ac5c637e449a39c855e7bd55945318d
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Build Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- name: Checkout code
|
17
|
+
uses: actions/checkout@v2
|
18
|
+
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
|
21
|
+
with:
|
22
|
+
ruby-version: '2.7'
|
23
|
+
|
24
|
+
- name: Build gem
|
25
|
+
run: make gem
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*'
|
7
|
+
|
8
|
+
env:
|
9
|
+
RUBYGEMS_USER: ${{ secrets.RUBYGEMS_USER }}
|
10
|
+
RUBYGEMS_PASSWORD: ${{ secrets.RUBYGEMS_PASSWORD }}
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
publish:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- name: Checkout code
|
18
|
+
uses: actions/checkout@v2
|
19
|
+
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
|
22
|
+
with:
|
23
|
+
ruby-version: '2.7'
|
24
|
+
|
25
|
+
- name: Publish gem
|
26
|
+
run: |
|
27
|
+
curl -u $RUBYGEMS_USER:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
|
28
|
+
chmod 0600 ~/.gem/credentials
|
29
|
+
make push
|
30
|
+
env:
|
31
|
+
RUBYGEMS_USER: ${{ secrets.RUBYGEMS_USER }}
|
32
|
+
RUBYGEMS_PASSWORD: ${{ secrets.RUBYGEMS_PASSWORD }}
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Redaction filter plugin for Fluentd
|
2
2
|
|
3
3
|
[](https://travis-ci.org/oleewere/fluent-plugin-redaction)
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
@@ -30,7 +30,7 @@ $ gem install fluent-plugin-redaction
|
|
30
30
|
<rule>
|
31
31
|
key message
|
32
32
|
value myemail@mail.com
|
33
|
-
replace ****@mail.com
|
33
|
+
replace "****@mail.com"
|
34
34
|
</rule>
|
35
35
|
<rule>
|
36
36
|
key message
|
@@ -39,7 +39,7 @@ $ gem install fluent-plugin-redaction
|
|
39
39
|
<rule>
|
40
40
|
key message
|
41
41
|
pattern /my_regex_pattern/
|
42
|
-
replace [REDACTED]
|
42
|
+
replace "[REDACTED]"
|
43
43
|
</rule>
|
44
44
|
</filter>
|
45
45
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -55,10 +55,10 @@ module Fluent
|
|
55
55
|
if rule[0]
|
56
56
|
record_value = record_value.gsub(rule[0], rule[2])
|
57
57
|
else
|
58
|
-
record_value = record_value.gsub(rule[1], rule[
|
58
|
+
record_value = record_value.gsub(rule[1], rule[2])
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
@accessors[key].set(record, record_value)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
record
|
@@ -22,10 +22,18 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
22
22
|
pattern /(hell)/
|
23
23
|
<rule>
|
24
24
|
key message
|
25
|
-
|
25
|
+
pattern /(hell)/
|
26
26
|
</rule>
|
27
27
|
]
|
28
28
|
|
29
|
+
CUSTOMIZED_REDACT_PATTERN_CONFIG = %[
|
30
|
+
<rule>
|
31
|
+
pattern /(?-i)eyJ(?i)[a-z0-9\-_%]+\.(?-i)eyJ(?i)[a-z0-9\-_%]+\.[a-z0-9\-_%]+/
|
32
|
+
key $.properties.userId
|
33
|
+
replace "[REDACTED]"
|
34
|
+
</rule>
|
35
|
+
]
|
36
|
+
|
29
37
|
setup do
|
30
38
|
Fluent::Test.setup
|
31
39
|
end
|
@@ -54,4 +62,13 @@ class RubyFilterTest < Test::Unit::TestCase
|
|
54
62
|
end
|
55
63
|
end
|
56
64
|
|
65
|
+
sub_test_case 'filter' do
|
66
|
+
test 'Filter JWT token from hello messages with nested key input' do
|
67
|
+
msg = {'properties' => {'userId' => 'Bearer eyJlola1H9jIq.eyJo1Zdmd8sHuz.KahSbdi9'}}
|
68
|
+
es = emit(msg, CUSTOMIZED_REDACT_PATTERN_CONFIG)
|
69
|
+
assert_equal("Bearer [REDACTED]", "#{es[0][1]["properties"]["userId"]}")
|
70
|
+
assert_not_equal("Bearer [REDACTED]", "#{es[0][1]["$.properties.userId"]}")
|
71
|
+
assert_equal("", "#{es[0][1]["$.properties.userId"]}")
|
72
|
+
end
|
73
|
+
end
|
57
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Szabo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -92,8 +92,9 @@ executables: []
|
|
92
92
|
extensions: []
|
93
93
|
extra_rdoc_files: []
|
94
94
|
files:
|
95
|
+
- ".github/workflows/build.yml"
|
96
|
+
- ".github/workflows/publish.yml"
|
95
97
|
- ".gitignore"
|
96
|
-
- ".travis.yml"
|
97
98
|
- Gemfile
|
98
99
|
- LICENSE
|
99
100
|
- Makefile
|
@@ -123,11 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
- !ruby/object:Gem::Version
|
124
125
|
version: '0'
|
125
126
|
requirements: []
|
126
|
-
|
127
|
-
rubygems_version: 2.5.1
|
127
|
+
rubygems_version: 3.1.6
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Fluentd redaction filter plugin for anonymize specific strings in text data.
|
131
|
-
test_files:
|
132
|
-
- test/helper.rb
|
133
|
-
- test/plugin/test_filter_redaction.rb
|
131
|
+
test_files: []
|