appsignal 3.0.24-java → 3.0.25-java

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: 8aa21a9008de8449831a37ad9605367b86e8fb27e480a215108229217a65134a
4
- data.tar.gz: 9b2ed342eb75461e8c19788789ca254dadbfc6d97ec1eb226438d3c4b91c25c2
3
+ metadata.gz: deaef7e2168cb358393f26888084c1ea47efd1a370022a74a751c12b3d2a5f05
4
+ data.tar.gz: b8df7d9e2c01c03797a17e253dcb1cd54ed5df50b533deb4a91e94c5cdf7a3f8
5
5
  SHA512:
6
- metadata.gz: eda047de46e8396a5682cda200980f92dfd0769e0f12ec4eb60a140fa8e594297d4181c840d20d62164f1b64498e829f8df23caf6cbe6541525d2f601f44f21c
7
- data.tar.gz: 7c7a6df9b85a50d3f56853a5ba3f7412a09a68312db3703a7c4937afa440157fc04a4b6931184f1039d5fbb22b37c35e346f88a2f917ee032cb7aea32de2868c
6
+ metadata.gz: f760735aa2fffb0680e00f5b8bc771a9d6ff22bcdb4e13f7bbba0753ae5390ac35d6b9ecc49a388e3290ad2d53fe392e5f5b9a1fc73d1c6f6a52887f93a6ccbc
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: java
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