sentry-sanitizer 0.9.0 → 0.10.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed85a8f652fb2b3b54796967d622c65699a630543a2911ccfdd1c30cf74704c7
4
- data.tar.gz: 2cc6ea9f662817521cc22663734ae392a48ca6fbab77a785897e97d64766c70b
3
+ metadata.gz: 66ddbe0333a1066f7d4211acfcc2aac24576a4746250bd704e3a89463f079819
4
+ data.tar.gz: f468dfe97322b7a7c292f500359452c689be0714b13715d2efb61f75e0144e19
5
5
  SHA512:
6
- metadata.gz: 727f6686da725234549fda38f2125e530ace8f641a9ea95469a692edf28f8a07863aeded84c4226ad7871c836ccbb6d6c504b671b97ed818fc02808b45e89e5c
7
- data.tar.gz: 47da7c136e56db35e7435ae5d579ebc19f00bb2e0fb575c9e1b5e41e984a710d6804a815aa662428341b2a3d8b46254a392a529d015b93b06447c581ce8ade3e
6
+ metadata.gz: fc6683ac363591cc334b986955bb2c5bbc7590d883139b62f5e6347c5782ef01255a5db627deaa026270267434f1fa2769e4df7e2f6b696c48aa207cd5a58b9f
7
+ data.tar.gz: a12af9ce0587f0d8d4068524bf34c1db70d66114ce04348d2a210d54798099d6b27bc2e669720fb16bb246727a5d2ef38d00604be773988f7b756672002544d8
@@ -1,4 +1,4 @@
1
- name: CI linux
1
+ name: CI
2
2
  on:
3
3
  push:
4
4
  pull_request:
@@ -11,6 +11,7 @@ jobs:
11
11
  matrix:
12
12
  include:
13
13
  - { ruby_version: 3.3, sentry_version: "~> 6.0" }
14
+ - { ruby_version: 3.3, sentry_version: "~> 7.0" }
14
15
  - { ruby_version: 3.4, sentry_version: "~> 6.0" }
15
16
  - { ruby_version: 3.4, sentry_version: "~> 7.0" }
16
17
  - { ruby_version: 4.0, sentry_version: "~> 6.0" }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ - Sanitize transaction events (`before_send_transaction`) and check-in events (`before_send_check_in`). Only `request` and `extra` are sanitized; span data is not
6
+ - Allow multiple `before_send_transaction` and `before_send_check_in` hooks
7
+ - Stop the `before_send` hook chain when a hook returns `nil`, so next hooks do not get `nil`
8
+
3
9
  ## 0.9.0
4
10
 
5
11
  - Add `filter` option to pass a custom filter, e.g. `ActiveSupport::ParameterFilter` [#25](https://github.com/mrexox/sentry-sanitizer/pull/25)
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sentry-sanitizer (0.9.0)
5
- sentry-ruby (>= 5.3, < 8.0.0)
4
+ sentry-sanitizer (0.10.0)
5
+ sentry-ruby (>= 6.0, < 8.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CI](https://github.com/mrexox/sentry-sanitizer/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/mrexox/sentry-sanitizer/actions/workflows/ci-linux.yml)
1
+ [![CI](https://github.com/mrexox/sentry-sanitizer/actions/workflows/ci.yml/badge.svg)](https://github.com/mrexox/sentry-sanitizer/actions/workflows/ci.yml)
2
2
  [![Gem Version](https://badge.fury.io/rb/sentry-sanitizer.svg)](https://badge.fury.io/rb/sentry-sanitizer)
3
3
  [![Coverage Status](https://coveralls.io/repos/github/mrexox/sentry-sanitizer/badge.svg?branch=master)](https://coveralls.io/github/mrexox/sentry-sanitizer?branch=master)
4
4
 
@@ -23,6 +23,18 @@ module Sentry
23
23
  event
24
24
  }
25
25
 
26
+ self.before_send_transaction = lambda { |event, _hint|
27
+ Sentry::Sanitizer::Cleaner.new(Sentry.configuration.sanitize).call(event)
28
+
29
+ event
30
+ }
31
+
32
+ self.before_send_check_in = lambda { |event, _hint|
33
+ Sentry::Sanitizer::Cleaner.new(Sentry.configuration.sanitize).call(event)
34
+
35
+ event
36
+ }
37
+
26
38
  self.before_breadcrumb = lambda { |breadcrumb, _hint|
27
39
  Sentry::Sanitizer::Cleaner.new(Sentry.configuration.sanitize).call(breadcrumb)
28
40
 
@@ -4,11 +4,12 @@ module Sentry
4
4
  module Sanitizer
5
5
  module ConfigurationMixin
6
6
  # Allow adding multiple hooks to `before_send`, so user hooks are not ignored.
7
+ # Available since sentry-ruby 4.5.0
7
8
  #
8
9
  # @param [nil, #call] value
9
10
  #
10
11
  def before_send=(value)
11
- raise ArgumentError, "before_send must be callable (or nil to disable)" unless value.nil? || value == false || value.respond_to?(:call)
12
+ _check_callable!("before_send", value)
12
13
 
13
14
  return unless value
14
15
 
@@ -18,6 +19,53 @@ module Sentry
18
19
  @before_send = lambda { |event, hint|
19
20
  @before_send_hook_list.each do |hook|
20
21
  event = hook.call(event, hint)
22
+ break unless event
23
+ end
24
+
25
+ event
26
+ }
27
+ end
28
+
29
+ # Allow adding multiple hooks to `before_send_transaction`, so user hooks are not ignored.
30
+ # Available since sentry-ruby 5.8.0
31
+ #
32
+ # @param [nil, #call] value
33
+ #
34
+ def before_send_transaction=(value)
35
+ _check_callable!("before_send_transaction", value)
36
+
37
+ return unless value
38
+
39
+ @before_send_transaction_hook_list ||= []
40
+ @before_send_transaction_hook_list << value
41
+
42
+ @before_send_transaction = lambda { |event, hint|
43
+ @before_send_transaction_hook_list.each do |hook|
44
+ event = hook.call(event, hint)
45
+ break unless event
46
+ end
47
+
48
+ event
49
+ }
50
+ end
51
+
52
+ # Allow adding multiple hooks to `before_send_check_in`, so user hooks are not ignored.
53
+ # Available since sentry-ruby 6.0.0
54
+ #
55
+ # @param [nil, #call] value
56
+ #
57
+ def before_send_check_in=(value)
58
+ _check_callable!("before_send_check_in", value)
59
+
60
+ return unless value
61
+
62
+ @before_send_check_in_hook_list ||= []
63
+ @before_send_check_in_hook_list << value
64
+
65
+ @before_send_check_in = lambda { |event, hint|
66
+ @before_send_check_in_hook_list.each do |hook|
67
+ event = hook.call(event, hint)
68
+ break unless event
21
69
  end
22
70
 
23
71
  event
@@ -25,11 +73,12 @@ module Sentry
25
73
  end
26
74
 
27
75
  # Allow adding multiple hooks to `before_breadcrumb`, so user hooks are not ignored.
76
+ # Available since sentry-ruby 4.5.0
28
77
  #
29
78
  # @param [nil, #call] value
30
79
  #
31
80
  def before_breadcrumb=(value)
32
- raise ArgumentError, "before_breadcrumb must be callable (or nil to disable)" unless value.nil? || value == false || value.respond_to?(:call)
81
+ _check_callable!("before_breadcrumb", value)
33
82
 
34
83
  return unless value
35
84
 
@@ -45,6 +94,12 @@ module Sentry
45
94
  breadcrumb
46
95
  }
47
96
  end
97
+
98
+ private
99
+
100
+ def _check_callable!(hook, value)
101
+ raise ArgumentError, "#{hook} must be callable (or nil to disable)" unless value.nil? || value == false || value.respond_to?(:call)
102
+ end
48
103
  end
49
104
  end
50
105
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sentry
4
4
  module Sanitizer
5
- VERSION = "0.9.0"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_runtime_dependency "sentry-ruby", ">= 5.3", "< 8.0.0"
30
+ spec.add_runtime_dependency "sentry-ruby", ">= 6.0", "< 8.0.0"
31
31
  spec.metadata["rubygems_mfa_required"] = "true"
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-sanitizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentine Kiselev
@@ -15,7 +15,7 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '5.3'
18
+ version: '6.0'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 8.0.0
@@ -25,7 +25,7 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '5.3'
28
+ version: '6.0'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: 8.0.0
@@ -36,8 +36,7 @@ executables: []
36
36
  extensions: []
37
37
  extra_rdoc_files: []
38
38
  files:
39
- - ".github/workflows/ci-linux.yml"
40
- - ".github/workflows/ci-macos.yml"
39
+ - ".github/workflows/ci.yml"
41
40
  - ".github/workflows/coveralls-report.yml"
42
41
  - ".gitignore"
43
42
  - ".rspec"
@@ -1,40 +0,0 @@
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: 3.3, sentry_version: "~> 6.0" }
14
- - { ruby_version: 3.4, sentry_version: "~> 6.0" }
15
- - { ruby_version: 3.4, sentry_version: "~> 7.0" }
16
- - { ruby_version: 4.0, sentry_version: "~> 6.0" }
17
- - { ruby_version: 4.0, sentry_version: "~> 7.0" }
18
- - { ruby_version: jruby, sentry_version: "~> 6.0" }
19
- env:
20
- SENTRY_VERSION: ${{ matrix.sentry_version }}
21
- steps:
22
- - uses: actions/checkout@v1
23
-
24
- - name: Set up Ruby ${{ matrix.ruby_version }}
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- bundler: 2
28
- ruby-version: ${{ matrix.ruby_version }}
29
-
30
- - name: Run specs
31
- run: |
32
- bundle install --jobs 4 --retry 3 --no-cache
33
- bundle exec rspec
34
-
35
- - uses: coverallsapp/github-action@v2
36
- env:
37
- COVERALLS_SERVICE_NUMBER: ${{ github.sha }}
38
- with:
39
- flag-name: ruby-${{ join(matrix.*, '-') }}
40
- parallel: true