sentry-sanitizer 0.8.1 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e3ae07df2c33f9b3645f0373930e8f65e7e4f6a534de04f4c99b72ecf18d5fc
4
- data.tar.gz: 134ed7f4cc8543c9adef837d496b9b4cd373559e2b7df2e4af050b26a82323a9
3
+ metadata.gz: a7bc289ffde1f50c00d106f61043ad632a52ecd968a7bf71bdafd547e5cb2925
4
+ data.tar.gz: 4b73825010b886929ff60d7700691dfb37ee2fc0c7e732ff676e07dbf89a399d
5
5
  SHA512:
6
- metadata.gz: 99bcd59ea6868db8200f06f5bf4fa8024d3d4b1b39b2ea1c28571ea3acbffe34f1250c06ff2439c3a395325b07b98e83d45281e85c9150395f62a0528a33fd75
7
- data.tar.gz: 15268636d41bbedaed9b45ef48b947ef27eb0c6d4243efa1530bf7dcbb77b292afab492d2da0e2b56711df30aa7aaabb93a1060e32a5511ec4c217fa2c3200a2
6
+ metadata.gz: 6e406797082235874ef3d9cdcfa7c969309931793c95150731f5ccedfece04b60e82b16395a34a51f93677ee768eb5500aeda889f0895a2c7778b326f1e7bf18
7
+ data.tar.gz: 4d287d7119d61cebfdc72203268e6d6c4c1668822a829025031b03dbc289e74913b538b9e0d64711143d34e6dd830d565dbd322a456cf71d6718dd678e5a211a
@@ -10,13 +10,14 @@ jobs:
10
10
  strategy:
11
11
  matrix:
12
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 }
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 }}
20
21
  steps:
21
22
  - uses: actions/checkout@v1
22
23
 
@@ -10,13 +10,14 @@ jobs:
10
10
  strategy:
11
11
  matrix:
12
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 }
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 }}
20
21
  steps:
21
22
  - uses: actions/checkout@v1
22
23
 
@@ -37,4 +38,3 @@ jobs:
37
38
  with:
38
39
  flag-name: ruby-${{ join(matrix.*, '-') }}
39
40
  parallel: true
40
-
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.2
4
+
5
+ - Sanitize breadcrumb data only if it's a Hash [#22](https://github.com/mrexox/sentry-sanitizer/pull/22)
6
+
3
7
  ## 0.8.1
4
8
 
5
9
  - Fix breadcrumb data[:body] == nil handling [#20](https://github.com/mrexox/sentry-sanitizer/pull/20)
data/Gemfile CHANGED
@@ -7,7 +7,14 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
7
7
  # Specify your gem's dependencies in sentry-sanitizer.gemspec
8
8
  gemspec
9
9
 
10
+ gem "sentry-ruby", ENV.fetch("SENTRY_VERSION", "~> 6.0")
11
+ # sentry-ruby requires "logger" internally but only declares it as a dependency
12
+ # itself from ~6.3.1/7.0 onwards; older sentry-ruby versions rely on it being a
13
+ # stdlib default gem, which Ruby 4.0 no longer bundles by default.
14
+ gem "logger"
15
+
10
16
  gem "base64"
17
+ gem "cgi"
11
18
  gem "rubocop", "~> 1.28.2"
12
19
  gem "simplecov", require: false, group: :test
13
20
 
data/Gemfile.lock CHANGED
@@ -1,18 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sentry-sanitizer (0.8.1)
5
- sentry-ruby (>= 5.3, < 7.0.0)
4
+ sentry-sanitizer (0.8.3)
5
+ sentry-ruby (>= 5.3, < 8.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.3)
11
11
  base64 (0.3.0)
12
- bigdecimal (3.3.1)
13
- concurrent-ruby (1.3.5)
12
+ bigdecimal (4.1.3)
13
+ cgi (0.5.2)
14
+ concurrent-ruby (1.3.8)
14
15
  diff-lcs (1.5.0)
15
16
  docile (1.4.0)
17
+ logger (1.7.0)
16
18
  parallel (1.27.0)
17
19
  parser (3.3.10.0)
18
20
  ast (~> 2.4.1)
@@ -50,9 +52,10 @@ GEM
50
52
  parser (>= 3.3.7.2)
51
53
  prism (~> 1.4)
52
54
  ruby-progressbar (1.13.0)
53
- sentry-ruby (6.0.0)
55
+ sentry-ruby (6.7.0)
54
56
  bigdecimal
55
57
  concurrent-ruby (~> 1.0, >= 1.0.2)
58
+ logger
56
59
  simplecov (0.18.5)
57
60
  docile (~> 1.1)
58
61
  simplecov-html (~> 0.11)
@@ -65,10 +68,13 @@ PLATFORMS
65
68
  DEPENDENCIES
66
69
  base64
67
70
  bundler (>= 2.3)
71
+ cgi
72
+ logger
68
73
  rack
69
74
  rake (~> 12)
70
75
  rspec (~> 3.0)
71
76
  rubocop (~> 1.28.2)
77
+ sentry-ruby (~> 6.0)
72
78
  sentry-sanitizer!
73
79
  simplecov
74
80
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![CI](https://github.com/mrexox/sentry-sanitizer/workflows/CI/badge.svg)
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)
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
 
@@ -14,11 +14,10 @@ Currently this gem provides following features
14
14
  - [x] Sanitizing cookies
15
15
  - [x] Sanitizing query string
16
16
  - [x] Sanitizing extras ([see](https://docs.sentry.io/platforms/ruby/enriching-events/context/#additional-data) `Sentry.set_extras`)
17
+ - [x] Sanitizing breadcrumb data fields
17
18
 
18
19
  ## Installation
19
20
 
20
- :warning: Please, don't use `0.1.*` version as it was experimental and not usable at all.
21
-
22
21
  Add this line to your application's Gemfile:
23
22
 
24
23
  ```ruby
@@ -66,15 +65,23 @@ Sentry.init do |config|
66
65
  end
67
66
  ```
68
67
 
69
- ## Development
68
+ ## Development hints
69
+
70
+ Install dependencies
71
+
72
+ $ bin/setup
73
+
74
+ Experiment with the code in IRB
75
+
76
+ $ bin/console
70
77
 
71
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
78
+ Run tests
72
79
 
73
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
80
+ $ bin/rake test
74
81
 
75
82
  ## Contributing
76
83
 
77
- Bug reports and pull requests are welcome on GitHub at https://github.com/mrexox/sentry-sanitizer.
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mrexox/sentry-sanitizer/issues.
78
85
 
79
86
  ## License
80
87
 
@@ -65,7 +65,7 @@ module Sentry
65
65
 
66
66
  def sanitize_breadcrumb!(breadcrumb)
67
67
  return unless breadcrumbs_json_data_fields.size.positive?
68
- return unless breadcrumb.data
68
+ return unless breadcrumb.data.is_a? Hash
69
69
 
70
70
  breadcrumbs_json_data_fields.each do |field|
71
71
  next unless breadcrumb.data.key?(field)
@@ -125,8 +125,20 @@ module Sentry
125
125
 
126
126
  def sanitize_query_string(query_string)
127
127
  return query_string unless do_query_string
128
- return query_string unless query_string.is_a? String
129
128
 
129
+ case query_string
130
+ when String
131
+ sanitize_query_string_from_string(query_string)
132
+ when Hash
133
+ sanitize_data(query_string)
134
+ else
135
+ query_string
136
+ end
137
+ end
138
+
139
+ # sentry-ruby >= 7 populates Request#query_string as a Hash (from Rack's
140
+ # parsed request.GET) instead of the raw query string.
141
+ def sanitize_query_string_from_string(query_string)
130
142
  sanitized_array = query_string.split("&").map do |kv_pair|
131
143
  k, v = kv_pair.split("=")
132
144
  new_v = sanitize_string(k, v)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sentry
4
4
  module Sanitizer
5
- VERSION = "0.8.1"
5
+ VERSION = "0.8.3"
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", "< 7.0.0"
30
+ spec.add_runtime_dependency "sentry-ruby", ">= 5.3", "< 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.8.1
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentine Kiselev
@@ -18,7 +18,7 @@ dependencies:
18
18
  version: '5.3'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: 7.0.0
21
+ version: 8.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,7 +28,7 @@ dependencies:
28
28
  version: '5.3'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: 7.0.0
31
+ version: 8.0.0
32
32
  description: Add missing sanitizing support for sentry-ruby (previous sentry-raven)
33
33
  email:
34
34
  - mrexox@outlook.com