appsignal 3.0.24 → 3.0.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc3f95c67f5a07b90ad69c93d22966628bf93c8e5fb24c0920ee2b9faf0e9107
4
- data.tar.gz: 9b2ed342eb75461e8c19788789ca254dadbfc6d97ec1eb226438d3c4b91c25c2
3
+ metadata.gz: 6a6b498f09de7b423c123bf8411112890dd5d7092169cbcc153b76db2fa51458
4
+ data.tar.gz: b8df7d9e2c01c03797a17e253dcb1cd54ed5df50b533deb4a91e94c5cdf7a3f8
5
5
  SHA512:
6
- metadata.gz: 15344ae58ab31b923ef5687c7ad2feeb5ed740131f406a3ec523343ac7cb3caf4626aa760554fb1cdc1d47f6a032da1c46f68bd01289579bb8e0855332f9d664
7
- data.tar.gz: 7c7a6df9b85a50d3f56853a5ba3f7412a09a68312db3703a7c4937afa440157fc04a4b6931184f1039d5fbb22b37c35e346f88a2f917ee032cb7aea32de2868c
6
+ metadata.gz: 37f63f86778f6216c7b1d766dde71b0faaec1960c3d776336ed43d7e623e0388c9a5b3024541c36ed5269346146e5022fd29355d74ec78816468ae94abaa4ab4
7
+ data.tar.gz: 17ff605c14abb3363494062533d33d52f0c64b53c01e9f8a700ecf8d8d22dcdb5f0e55b2be6db9a34b1233d9b2da65dc85ce9227df8d148d49dd5d33492686f8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.0.25
4
+
5
+ ### Added
6
+
7
+ - [399cf790](https://github.com/appsignal/appsignal-ruby/commit/399cf79044e7c8936ab72dce420d91af4cb71d16) patch - Sanitize `ActiveRecord::RecordNotUnique` error messages to not include any database values that is not unique in the database. This ensures no personal information is sent to AppSignal through error messages from this error.
8
+
3
9
  ## 3.0.24
4
10
 
5
11
  ### Changed
@@ -537,7 +537,7 @@ module Appsignal
537
537
  # Returns an unchanged message otherwise.
538
538
  def cleaned_error_message(error)
539
539
  case error.class.to_s
540
- when "PG::UniqueViolation"
540
+ when "PG::UniqueViolation", "ActiveRecord::RecordNotUnique"
541
541
  error.message.to_s.gsub(/\)=\(.*\)/, ")=(?)")
542
542
  else
543
543
  error.message.to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.0.24".freeze
4
+ VERSION = "3.0.25".freeze
5
5
  end
@@ -376,7 +376,7 @@ if DependencyHelper.active_job_present?
376
376
  ]
377
377
  end
378
378
  let(:expected_wrapped_args) do
379
- if (DependencyHelper.rails6_1_present? && DependencyHelper.ruby_3_1_or_newer?) || DependencyHelper.rails7_present?
379
+ if DependencyHelper.active_job_wraps_args?
380
380
  [{
381
381
  "_aj_ruby2_keywords" => ["args"],
382
382
  "args" => expected_args
@@ -1350,8 +1350,8 @@ describe Appsignal::Transaction do
1350
1350
  end
1351
1351
 
1352
1352
  context "with a PG::UniqueViolation" do
1353
- module PG
1354
- class UniqueViolation < StandardError; end
1353
+ before do
1354
+ stub_const("PG::UniqueViolation", Class.new(StandardError))
1355
1355
  end
1356
1356
 
1357
1357
  let(:error) do
@@ -1364,6 +1364,25 @@ describe Appsignal::Transaction do
1364
1364
  expect(subject).to eq "ERROR: duplicate key value violates unique constraint \"index_users_on_email\" DETAIL: Key (email)=(?) already exists."
1365
1365
  end
1366
1366
  end
1367
+
1368
+ context "with a ActiveRecord::RecordNotUnique" do
1369
+ before do
1370
+ stub_const("ActiveRecord::RecordNotUnique", Class.new(StandardError))
1371
+ end
1372
+
1373
+ let(:error) do
1374
+ ActiveRecord::RecordNotUnique.new(
1375
+ "PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"example_constraint\"\n" \
1376
+ "DETAIL: Key (email)=(foo@example.com) already exists."
1377
+ )
1378
+ end
1379
+
1380
+ it "returns a sanizited error message" do
1381
+ expect(subject).to eq \
1382
+ "PG::UniqueViolation: ERROR: duplicate key value violates unique constraint \"example_constraint\"\n" \
1383
+ "DETAIL: Key (email)=(?) already exists."
1384
+ end
1385
+ end
1367
1386
  end
1368
1387
 
1369
1388
  describe ".to_hash / .to_h" do
@@ -1,6 +1,6 @@
1
1
  module ActiveJobHelpers
2
2
  def active_job_args_wrapper(args: [], params: nil)
3
- if (DependencyHelper.rails6_1_present? && DependencyHelper.ruby_3_1_or_newer?) || DependencyHelper.rails7_present?
3
+ if DependencyHelper.active_job_wraps_args?
4
4
  wrapped_args = {}
5
5
 
6
6
  if params
@@ -29,10 +29,18 @@ module DependencyHelper
29
29
  rails_present? && rails_version >= Gem::Version.new("6.1.0")
30
30
  end
31
31
 
32
+ def rails6_1_5_present?
33
+ rails_present? && rails_version >= Gem::Version.new("6.1.5")
34
+ end
35
+
32
36
  def rails7_present?
33
37
  rails_present? && rails_version >= Gem::Version.new("7.0.0")
34
38
  end
35
39
 
40
+ def active_job_wraps_args?
41
+ rails7_present? || (ruby_3_1_or_newer? && rails6_1_present? && !rails6_1_5_present?)
42
+ end
43
+
36
44
  def rails_version
37
45
  Gem.loaded_specs["rails"].version
38
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.24
4
+ version: 3.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-02-24 00:00:00.000000000 Z
13
+ date: 2022-03-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack