sentry-sanitizer 0.6.1 → 0.7.1
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/.github/workflows/{ci.yml → ci-linux.yml} +9 -6
- data/.github/workflows/ci-macos.yml +40 -0
- data/.github/workflows/coveralls-report.yml +38 -0
- data/.rubocop.yml +36 -0
- data/CHANGELOG.md +3 -1
- data/Gemfile +12 -1
- data/Gemfile.lock +34 -8
- data/README.md +1 -1
- data/Rakefile +4 -1
- data/bin/console +1 -0
- data/lefthook.yml +6 -0
- data/lib/sentry/sanitizer/cleaner.rb +39 -28
- data/lib/sentry/sanitizer/configuration.rb +17 -25
- data/lib/sentry/sanitizer/configuration_mixin.rb +4 -4
- data/lib/sentry/sanitizer/version.rb +3 -1
- data/lib/sentry/sanitizer.rb +6 -4
- data/lib/sentry-sanitizer.rb +4 -2
- data/sentry-sanitizer.gemspec +16 -24
- data/tea.yml +6 -0
- metadata +17 -92
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a17ef6bdd4061a447ed69376728f59f1578882a85018d88907bf39cbd25f0303
|
|
4
|
+
data.tar.gz: 15bcf120b47c8901516c749164d8cd4c9f994c8a9f2d3603a735fe5c1047b276
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f2ea7603ad649947b2722136a4beee57517164b1387260ca033ae897a37facdab56ecf3df8eae50b4659a6ee56fcd44b4eeb0c8afbbe2d08cf9517835289789e
|
|
7
|
+
data.tar.gz: 4648b1845b6ed34d11af14ea769f0bcd1c21dd3cfe7b9488d371f0fcffdafb98e22e4596171c0896715b0539f6b4ca316389c91d75d17b84d0971f267c8f8cd3
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
name: CI
|
|
1
|
+
name: CI linux
|
|
2
2
|
on:
|
|
3
3
|
push:
|
|
4
|
-
branches:
|
|
5
|
-
- master
|
|
6
4
|
pull_request:
|
|
7
5
|
|
|
8
6
|
jobs:
|
|
@@ -12,10 +10,12 @@ jobs:
|
|
|
12
10
|
strategy:
|
|
13
11
|
matrix:
|
|
14
12
|
include:
|
|
15
|
-
- { ruby_version: 2.5 }
|
|
16
13
|
- { ruby_version: 2.7 }
|
|
17
14
|
- { ruby_version: 3.0 }
|
|
18
15
|
- { ruby_version: 3.1 }
|
|
16
|
+
- { ruby_version: 3.2 }
|
|
17
|
+
- { ruby_version: 3.3 }
|
|
18
|
+
- { ruby_version: 3.4 }
|
|
19
19
|
- { ruby_version: jruby }
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v1
|
|
@@ -31,6 +31,9 @@ jobs:
|
|
|
31
31
|
bundle install --jobs 4 --retry 3 --no-cache
|
|
32
32
|
bundle exec rspec
|
|
33
33
|
|
|
34
|
-
- uses:
|
|
34
|
+
- uses: coverallsapp/github-action@v2
|
|
35
|
+
env:
|
|
36
|
+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
|
|
35
37
|
with:
|
|
36
|
-
|
|
38
|
+
flag-name: ruby-${{ join(matrix.*, '-') }}
|
|
39
|
+
parallel: true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CI macos
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
rspec:
|
|
8
|
+
name: Unit tests
|
|
9
|
+
runs-on: macos-13
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
include:
|
|
13
|
+
- { ruby_version: 2.7 }
|
|
14
|
+
- { ruby_version: 3.0 }
|
|
15
|
+
- { ruby_version: 3.1 }
|
|
16
|
+
- { ruby_version: 3.2 }
|
|
17
|
+
- { ruby_version: 3.3 }
|
|
18
|
+
- { ruby_version: 3.4 }
|
|
19
|
+
- { ruby_version: jruby }
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v1
|
|
22
|
+
|
|
23
|
+
- name: Set up Ruby ${{ matrix.ruby_version }}
|
|
24
|
+
uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
bundler: 2
|
|
27
|
+
ruby-version: ${{ matrix.ruby_version }}
|
|
28
|
+
|
|
29
|
+
- name: Run specs
|
|
30
|
+
run: |
|
|
31
|
+
bundle install --jobs 4 --retry 3 --no-cache
|
|
32
|
+
bundle exec rspec
|
|
33
|
+
|
|
34
|
+
- uses: coverallsapp/github-action@v2
|
|
35
|
+
env:
|
|
36
|
+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
|
|
37
|
+
with:
|
|
38
|
+
flag-name: ruby-${{ join(matrix.*, '-') }}
|
|
39
|
+
parallel: true
|
|
40
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Coveralls
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
coveralls:
|
|
8
|
+
name: Coveralls Report
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
if: ${{ always() }}
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
|
|
14
|
+
- name: Wait on tests (PR)
|
|
15
|
+
uses: lewagon/wait-on-check-action@v1.3.1
|
|
16
|
+
if: github.event_name == 'pull_request'
|
|
17
|
+
with:
|
|
18
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
19
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
wait-interval: 10 # seconds
|
|
21
|
+
running-workflow-name: Coveralls Report
|
|
22
|
+
allowed-conclusions: success,skipped,cancelled,failure
|
|
23
|
+
|
|
24
|
+
- name: Wait on tests
|
|
25
|
+
uses: lewagon/wait-on-check-action@v1.3.1
|
|
26
|
+
with:
|
|
27
|
+
ref: ${{ github.sha }}
|
|
28
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
wait-interval: 10 # seconds
|
|
30
|
+
running-workflow-name: Coveralls Report
|
|
31
|
+
allowed-conclusions: success,skipped,cancelled,failure
|
|
32
|
+
|
|
33
|
+
- uses: coverallsapp/github-action@v2
|
|
34
|
+
env:
|
|
35
|
+
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
|
|
36
|
+
with:
|
|
37
|
+
carryforward: "ruby-2.7,ruby-3.0,ruby-3.1,ruby-3.2,ruby-3.3,ruby-3.4,ruby-jruby"
|
|
38
|
+
parallel-finished: true
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
NewCops: enable
|
|
3
|
+
SuggestExtensions: false
|
|
4
|
+
|
|
5
|
+
Style/StringLiterals:
|
|
6
|
+
EnforcedStyle: double_quotes
|
|
7
|
+
|
|
8
|
+
Metrics/BlockLength:
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
11
|
+
Style/Documentation:
|
|
12
|
+
Enabled: false
|
|
13
|
+
|
|
14
|
+
Layout/LineLength:
|
|
15
|
+
Enabled: false
|
|
16
|
+
|
|
17
|
+
Naming/FileName:
|
|
18
|
+
Enabled: false
|
|
19
|
+
|
|
20
|
+
Metrics/MethodLength:
|
|
21
|
+
Enabled: false
|
|
22
|
+
|
|
23
|
+
Metrics/ClassLength:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
Metrics/AbcSize:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
Gemspec/RequiredRubyVersion:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Style/SelectByRegexp:
|
|
33
|
+
Enabled: false
|
|
34
|
+
|
|
35
|
+
Style/CaseLikeIf:
|
|
36
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source "https://rubygems.org"
|
|
2
4
|
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
6
|
|
|
5
7
|
# Specify your gem's dependencies in sentry-sanitizer.gemspec
|
|
6
8
|
gemspec
|
|
9
|
+
|
|
10
|
+
gem "base64"
|
|
11
|
+
gem "rubocop", "~> 1.28.2"
|
|
12
|
+
gem "simplecov", require: false, group: :test
|
|
13
|
+
|
|
14
|
+
gem "bundler", ">= 1.17"
|
|
15
|
+
gem "rack"
|
|
16
|
+
gem "rake", "~> 10.0"
|
|
17
|
+
gem "rspec", "~> 3.0"
|
data/Gemfile.lock
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
sentry-sanitizer (0.
|
|
5
|
-
sentry-ruby (
|
|
4
|
+
sentry-sanitizer (0.7.1)
|
|
5
|
+
sentry-ruby (>= 5.3, < 7.0.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
ast (2.4.3)
|
|
11
|
+
base64 (0.3.0)
|
|
12
|
+
bigdecimal (3.3.1)
|
|
13
|
+
concurrent-ruby (1.3.5)
|
|
13
14
|
diff-lcs (1.5.0)
|
|
14
15
|
docile (1.4.0)
|
|
16
|
+
parallel (1.27.0)
|
|
17
|
+
parser (3.3.10.0)
|
|
18
|
+
ast (~> 2.4.1)
|
|
19
|
+
racc
|
|
20
|
+
prism (1.6.0)
|
|
21
|
+
racc (1.8.1)
|
|
15
22
|
rack (2.2.3.1)
|
|
23
|
+
rainbow (3.1.1)
|
|
16
24
|
rake (10.5.0)
|
|
25
|
+
regexp_parser (2.11.3)
|
|
26
|
+
rexml (3.4.4)
|
|
17
27
|
rspec (3.11.0)
|
|
18
28
|
rspec-core (~> 3.11.0)
|
|
19
29
|
rspec-expectations (~> 3.11.0)
|
|
@@ -27,24 +37,40 @@ GEM
|
|
|
27
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
28
38
|
rspec-support (~> 3.11.0)
|
|
29
39
|
rspec-support (3.11.0)
|
|
30
|
-
|
|
40
|
+
rubocop (1.28.2)
|
|
41
|
+
parallel (~> 1.10)
|
|
42
|
+
parser (>= 3.1.0.0)
|
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
44
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
45
|
+
rexml
|
|
46
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
|
47
|
+
ruby-progressbar (~> 1.7)
|
|
48
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
49
|
+
rubocop-ast (1.47.1)
|
|
50
|
+
parser (>= 3.3.7.2)
|
|
51
|
+
prism (~> 1.4)
|
|
52
|
+
ruby-progressbar (1.13.0)
|
|
53
|
+
sentry-ruby (6.0.0)
|
|
54
|
+
bigdecimal
|
|
31
55
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
32
56
|
simplecov (0.18.5)
|
|
33
57
|
docile (~> 1.1)
|
|
34
58
|
simplecov-html (~> 0.11)
|
|
35
59
|
simplecov-html (0.12.3)
|
|
60
|
+
unicode-display_width (2.6.0)
|
|
36
61
|
|
|
37
62
|
PLATFORMS
|
|
38
63
|
ruby
|
|
39
64
|
|
|
40
65
|
DEPENDENCIES
|
|
66
|
+
base64
|
|
41
67
|
bundler (>= 1.17)
|
|
42
|
-
codecov
|
|
43
68
|
rack
|
|
44
69
|
rake (~> 10.0)
|
|
45
70
|
rspec (~> 3.0)
|
|
71
|
+
rubocop (~> 1.28.2)
|
|
46
72
|
sentry-sanitizer!
|
|
47
|
-
simplecov
|
|
73
|
+
simplecov
|
|
48
74
|
|
|
49
75
|
BUNDLED WITH
|
|
50
76
|
2.3.16
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
[](https://badge.fury.io/rb/sentry-sanitizer)
|
|
3
|
-
[](https://coveralls.io/github/mrexox/sentry-sanitizer?branch=master)
|
|
4
4
|
|
|
5
5
|
# sentry-sanitizer: sanitizing extension for sentry-ruby
|
|
6
6
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lefthook.yml
ADDED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Sentry
|
|
2
4
|
module Sanitizer
|
|
3
5
|
class Cleaner
|
|
4
|
-
DEFAULT_MASK =
|
|
6
|
+
DEFAULT_MASK = "[FILTERED]"
|
|
5
7
|
DEFAULT_SENSITIVE_HEADERS = %w[
|
|
6
8
|
Authorization
|
|
7
9
|
X-Xsrf-Token
|
|
@@ -18,34 +20,42 @@ module Sentry
|
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def call(event)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
sanitize(event, :
|
|
23
|
+
case event
|
|
24
|
+
when Sentry::Event
|
|
25
|
+
sanitize(event, :event)
|
|
26
|
+
when Hash
|
|
27
|
+
sanitize(event, :hash)
|
|
26
28
|
end
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
def sanitize(event, type)
|
|
31
|
+
def sanitize(event, type) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
30
32
|
case type
|
|
31
|
-
when :
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
when :event
|
|
34
|
+
if event.request
|
|
35
|
+
event.request.data = sanitize_data(event.request.data)
|
|
36
|
+
event.request.headers = sanitize_headers(event.request.headers)
|
|
37
|
+
event.request.cookies = sanitize_cookies(event.request.cookies)
|
|
38
|
+
event.request.query_string = sanitize_query_string(event.request.query_string)
|
|
39
|
+
end
|
|
36
40
|
event.extra = sanitize_data(event.extra)
|
|
37
|
-
when :
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
when :hash
|
|
42
|
+
if event["request"]
|
|
43
|
+
event["request"]["data"] = sanitize_data(event["request"]["data"])
|
|
44
|
+
event["request"]["headers"] = sanitize_headers(event["request"]["headers"])
|
|
45
|
+
event["request"]["cookies"] = sanitize_cookies(event["request"]["cookies"])
|
|
46
|
+
event["request"]["query_string"] = sanitize_query_string(event["request"]["query_string"])
|
|
47
|
+
elsif event[:request]
|
|
48
|
+
event[:request][:data] = sanitize_data(event[:request][:data])
|
|
49
|
+
event[:request][:headers] = sanitize_headers(event[:request][:headers])
|
|
50
|
+
event[:request][:cookies] = sanitize_cookies(event[:request][:cookies])
|
|
51
|
+
event[:request][:query_string] = sanitize_query_string(event[:request][:query_string])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
if event["extra"]
|
|
55
|
+
event["extra"] = sanitize_data(event["extra"])
|
|
56
|
+
elsif event[:extra]
|
|
57
|
+
event[:extra] = sanitize_data(event[:extra])
|
|
58
|
+
end
|
|
49
59
|
end
|
|
50
60
|
end
|
|
51
61
|
|
|
@@ -71,6 +81,7 @@ module Sentry
|
|
|
71
81
|
headers.transform_values { mask }
|
|
72
82
|
when Array
|
|
73
83
|
return headers unless http_headers.size.positive?
|
|
84
|
+
|
|
74
85
|
http_headers_regex = sensitive_regexp(http_headers)
|
|
75
86
|
|
|
76
87
|
headers.keys.select { |key| key.match?(http_headers_regex) }.each do |key|
|
|
@@ -95,14 +106,14 @@ module Sentry
|
|
|
95
106
|
return query_string unless do_query_string
|
|
96
107
|
return query_string unless query_string.is_a? String
|
|
97
108
|
|
|
98
|
-
sanitized_array = query_string.split(
|
|
99
|
-
k, v = kv_pair.split(
|
|
109
|
+
sanitized_array = query_string.split("&").map do |kv_pair|
|
|
110
|
+
k, v = kv_pair.split("=")
|
|
100
111
|
new_v = sanitize_string(k, v)
|
|
101
112
|
|
|
102
113
|
"#{k}=#{new_v}"
|
|
103
114
|
end
|
|
104
115
|
|
|
105
|
-
sanitized_array.join(
|
|
116
|
+
sanitized_array.join("&")
|
|
106
117
|
end
|
|
107
118
|
|
|
108
119
|
def sanitize_value(value, key)
|
|
@@ -145,7 +156,7 @@ module Sentry
|
|
|
145
156
|
end
|
|
146
157
|
|
|
147
158
|
def sensitive_regexp(fields)
|
|
148
|
-
Regexp.new(fields.map { |field| "\\b#{field}\\b" }.join(
|
|
159
|
+
Regexp.new(fields.map { |field| "\\b#{field}\\b" }.join("|"), "i")
|
|
149
160
|
end
|
|
150
161
|
end
|
|
151
162
|
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sentry/configuration"
|
|
4
|
+
require "sentry/sanitizer/cleaner"
|
|
5
|
+
require "sentry/sanitizer/configuration_mixin"
|
|
4
6
|
|
|
5
7
|
module Sentry
|
|
6
8
|
# Monkey-patching Sentry::Configuration
|
|
@@ -14,21 +16,21 @@ module Sentry
|
|
|
14
16
|
add_post_initialization_callback do
|
|
15
17
|
@sanitize ||= Sentry::Sanitizer::Configuration.new
|
|
16
18
|
|
|
17
|
-
self.before_send =
|
|
19
|
+
self.before_send = lambda { |event, _hint|
|
|
18
20
|
Sentry::Sanitizer::Cleaner.new(Sentry.configuration.sanitize).call(event)
|
|
19
21
|
|
|
20
22
|
event
|
|
21
|
-
|
|
23
|
+
}
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
module Sanitizer
|
|
26
28
|
class Configuration
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
attr_reader :fields,
|
|
30
|
+
:http_headers,
|
|
31
|
+
:cookies,
|
|
32
|
+
:query_string,
|
|
33
|
+
:mask
|
|
32
34
|
|
|
33
35
|
def configured?
|
|
34
36
|
[
|
|
@@ -40,41 +42,31 @@ module Sentry
|
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
def fields=(fields)
|
|
43
|
-
unless fields.is_a? Array
|
|
44
|
-
raise ArgumentError, 'sanitize_fields must be array'
|
|
45
|
-
end
|
|
45
|
+
raise ArgumentError, "sanitize_fields must be array" unless fields.is_a? Array
|
|
46
46
|
|
|
47
47
|
@fields = fields
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def http_headers=(headers)
|
|
51
|
-
unless [Array, TrueClass, FalseClass].include?(headers.class)
|
|
52
|
-
raise ArgumentError, 'sanitize_http_headers must be array'
|
|
53
|
-
end
|
|
51
|
+
raise ArgumentError, "sanitize_http_headers must be array" unless [Array, TrueClass, FalseClass].include?(headers.class)
|
|
54
52
|
|
|
55
53
|
@http_headers = headers
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
def cookies=(cookies)
|
|
59
|
-
unless [TrueClass, FalseClass].include?(cookies.class)
|
|
60
|
-
raise ArgumentError, 'cookies must be boolean'
|
|
61
|
-
end
|
|
57
|
+
raise ArgumentError, "cookies must be boolean" unless [TrueClass, FalseClass].include?(cookies.class)
|
|
62
58
|
|
|
63
59
|
@cookies = cookies
|
|
64
60
|
end
|
|
65
61
|
|
|
66
62
|
def query_string=(query_string)
|
|
67
|
-
unless [TrueClass, FalseClass].include?(query_string.class)
|
|
68
|
-
raise ArgumentError, 'query_string must be boolean'
|
|
69
|
-
end
|
|
63
|
+
raise ArgumentError, "query_string must be boolean" unless [TrueClass, FalseClass].include?(query_string.class)
|
|
70
64
|
|
|
71
65
|
@query_string = query_string
|
|
72
66
|
end
|
|
73
67
|
|
|
74
68
|
def mask=(mask)
|
|
75
|
-
unless mask.is_a?(String)
|
|
76
|
-
raise ArgumentError, 'mask must be string'
|
|
77
|
-
end
|
|
69
|
+
raise ArgumentError, "mask must be string" unless mask.is_a?(String)
|
|
78
70
|
|
|
79
71
|
@mask = mask
|
|
80
72
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Sentry
|
|
2
4
|
module Sanitizer
|
|
3
5
|
module ConfigurationMixin
|
|
@@ -6,16 +8,14 @@ module Sentry
|
|
|
6
8
|
# @param [nil, false, #call] value
|
|
7
9
|
#
|
|
8
10
|
def before_send=(value)
|
|
9
|
-
unless value
|
|
10
|
-
raise ArgumentError, "before_send must be callable (or false to disable)"
|
|
11
|
-
end
|
|
11
|
+
raise ArgumentError, "before_send must be callable (or false to disable)" unless value.nil? || value == false || value.respond_to?(:call)
|
|
12
12
|
|
|
13
13
|
return unless value
|
|
14
14
|
|
|
15
15
|
@before_send_hook_list ||= []
|
|
16
16
|
@before_send_hook_list << value
|
|
17
17
|
|
|
18
|
-
@before_send =
|
|
18
|
+
@before_send = lambda { |event, hint|
|
|
19
19
|
@before_send_hook_list.each do |hook|
|
|
20
20
|
event = hook.call(event, hint)
|
|
21
21
|
end
|
data/lib/sentry/sanitizer.rb
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sentry-ruby"
|
|
4
|
+
require "sentry/integrable"
|
|
5
|
+
require "sentry/sanitizer/configuration"
|
|
4
6
|
|
|
5
7
|
module Sentry
|
|
6
8
|
module Sanitizer
|
|
7
9
|
extend Integrable
|
|
8
10
|
|
|
9
|
-
register_integration name:
|
|
11
|
+
register_integration name: "sanitizer", version: Sentry::Sanitizer::VERSION
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/sentry-sanitizer.rb
CHANGED
data/sentry-sanitizer.gemspec
CHANGED
|
@@ -1,40 +1,32 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require
|
|
5
|
+
require "sentry/sanitizer/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name =
|
|
8
|
+
spec.name = "sentry-sanitizer"
|
|
9
9
|
spec.version = Sentry::Sanitizer::VERSION
|
|
10
|
-
spec.authors = [
|
|
11
|
-
spec.email = [
|
|
10
|
+
spec.authors = ["Valentine Kiselev"]
|
|
11
|
+
spec.email = ["mrexox@outlook.com"]
|
|
12
12
|
|
|
13
|
-
spec.summary =
|
|
14
|
-
spec.description =
|
|
15
|
-
spec.homepage =
|
|
16
|
-
spec.license =
|
|
13
|
+
spec.summary = "Sanitizing middleware for sentry-ruby gem"
|
|
14
|
+
spec.description = "Add missing sanitizing support for sentry-ruby (previous sentry-raven)"
|
|
15
|
+
spec.homepage = "https://github.com/mrexox/sentry-sanitizer"
|
|
16
|
+
spec.license = "BSD"
|
|
17
17
|
|
|
18
|
-
spec.metadata[
|
|
19
|
-
spec.metadata[
|
|
20
|
-
spec.metadata[
|
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
|
21
21
|
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
-
spec.files
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
25
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
spec.require_paths = [
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
spec.
|
|
32
|
-
spec.add_development_dependency 'simplecov', '~> 0.18.5'
|
|
33
|
-
|
|
34
|
-
spec.add_development_dependency 'bundler', '>= 1.17'
|
|
35
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
36
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
37
|
-
spec.add_development_dependency 'rack'
|
|
38
|
-
|
|
39
|
-
spec.add_runtime_dependency 'sentry-ruby', '~> 5.3'
|
|
30
|
+
spec.add_runtime_dependency "sentry-ruby", ">= 5.3", "< 7.0.0"
|
|
31
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
40
32
|
end
|
data/tea.yml
ADDED
metadata
CHANGED
|
@@ -1,113 +1,34 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sentry-sanitizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Valentine Kiselev
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: simplecov
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.18.5
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.18.5
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: bundler
|
|
13
|
+
name: sentry-ruby
|
|
43
14
|
requirement: !ruby/object:Gem::Requirement
|
|
44
15
|
requirements:
|
|
45
16
|
- - ">="
|
|
46
17
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
48
|
-
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.17'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rake
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '10.0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '10.0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rspec
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '3.0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '3.0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rack
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
18
|
+
version: '5.3'
|
|
19
|
+
- - "<"
|
|
88
20
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
90
|
-
type: :
|
|
21
|
+
version: 7.0.0
|
|
22
|
+
type: :runtime
|
|
91
23
|
prerelease: false
|
|
92
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
25
|
requirements:
|
|
94
26
|
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: sentry-ruby
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - "~>"
|
|
102
27
|
- !ruby/object:Gem::Version
|
|
103
28
|
version: '5.3'
|
|
104
|
-
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - "~>"
|
|
29
|
+
- - "<"
|
|
109
30
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
31
|
+
version: 7.0.0
|
|
111
32
|
description: Add missing sanitizing support for sentry-ruby (previous sentry-raven)
|
|
112
33
|
email:
|
|
113
34
|
- mrexox@outlook.com
|
|
@@ -115,9 +36,12 @@ executables: []
|
|
|
115
36
|
extensions: []
|
|
116
37
|
extra_rdoc_files: []
|
|
117
38
|
files:
|
|
118
|
-
- ".github/workflows/ci.yml"
|
|
39
|
+
- ".github/workflows/ci-linux.yml"
|
|
40
|
+
- ".github/workflows/ci-macos.yml"
|
|
41
|
+
- ".github/workflows/coveralls-report.yml"
|
|
119
42
|
- ".gitignore"
|
|
120
43
|
- ".rspec"
|
|
44
|
+
- ".rubocop.yml"
|
|
121
45
|
- ".travis.yml"
|
|
122
46
|
- CHANGELOG.md
|
|
123
47
|
- Gemfile
|
|
@@ -127,6 +51,7 @@ files:
|
|
|
127
51
|
- Rakefile
|
|
128
52
|
- bin/console
|
|
129
53
|
- bin/setup
|
|
54
|
+
- lefthook.yml
|
|
130
55
|
- lib/sentry-sanitizer.rb
|
|
131
56
|
- lib/sentry/sanitizer.rb
|
|
132
57
|
- lib/sentry/sanitizer/cleaner.rb
|
|
@@ -134,6 +59,7 @@ files:
|
|
|
134
59
|
- lib/sentry/sanitizer/configuration_mixin.rb
|
|
135
60
|
- lib/sentry/sanitizer/version.rb
|
|
136
61
|
- sentry-sanitizer.gemspec
|
|
62
|
+
- tea.yml
|
|
137
63
|
homepage: https://github.com/mrexox/sentry-sanitizer
|
|
138
64
|
licenses:
|
|
139
65
|
- BSD
|
|
@@ -141,7 +67,7 @@ metadata:
|
|
|
141
67
|
homepage_uri: https://github.com/mrexox/sentry-sanitizer
|
|
142
68
|
source_code_uri: https://github.com/mrexox/sentry-sanitizer
|
|
143
69
|
changelog_uri: https://github.com/mrexox/sentry-sanitizer
|
|
144
|
-
|
|
70
|
+
rubygems_mfa_required: 'true'
|
|
145
71
|
rdoc_options: []
|
|
146
72
|
require_paths:
|
|
147
73
|
- lib
|
|
@@ -156,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
156
82
|
- !ruby/object:Gem::Version
|
|
157
83
|
version: '0'
|
|
158
84
|
requirements: []
|
|
159
|
-
rubygems_version: 3.
|
|
160
|
-
signing_key:
|
|
85
|
+
rubygems_version: 3.6.9
|
|
161
86
|
specification_version: 4
|
|
162
87
|
summary: Sanitizing middleware for sentry-ruby gem
|
|
163
88
|
test_files: []
|