From 20f7e75135a06de07d5a78579d709d4db0331fea Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Tue, 27 May 2025 09:32:42 +0000 Subject: [PATCH 1/2] Tweak credit card regex handling for OTP-28 Just like in #889 --- lib/sentry/plug_context.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/sentry/plug_context.ex b/lib/sentry/plug_context.ex index 1fb86e9b..d9f03bf5 100644 --- a/lib/sentry/plug_context.ex +++ b/lib/sentry/plug_context.ex @@ -155,7 +155,6 @@ defmodule Sentry.PlugContext do @default_scrubbed_param_keys ["password", "passwd", "secret"] @default_scrubbed_header_keys ["authorization", "authentication", "cookie"] - @credit_card_regex ~r/^(?:\d[ -]*?){13,16}$/ @scrubbed_value "*********" @default_plug_request_id_header "x-request-id" @@ -277,7 +276,7 @@ defmodule Sentry.PlugContext do value = cond do key in scrubbed_keys -> @scrubbed_value - is_binary(value) and value =~ @credit_card_regex -> @scrubbed_value + is_binary(value) and value =~ credit_card_regex() -> @scrubbed_value is_struct(value) -> value |> Map.from_struct() |> scrub_map(scrubbed_keys) is_map(value) -> scrub_map(value, scrubbed_keys) is_list(value) -> scrub_list(value, scrubbed_keys) @@ -298,4 +297,6 @@ defmodule Sentry.PlugContext do end end) end + + defp credit_card_regex, do: ~r/^(?:\d[ -]*?){13,16}$/ end From e56f41b4318a444212f7eb2addd98a933f6aa0b3 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Tue, 27 May 2025 09:39:41 +0000 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c991ef8e..3ee2f483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- Tweak credit card regex handling for OTP-28 ([#898](https://github.com/getsentry/sentry-elixir/pull/898)) + # Changelog ## 10.10.0