Skip to content

Commit cdcbc94

Browse files
authored
Tweak credit card regex handling for OTP-28 (#898)
* Tweak credit card regex handling for OTP-28 Just like in #889 * Update CHANGELOG
1 parent f85b956 commit cdcbc94

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Unreleased
2+
3+
- Tweak credit card regex handling for OTP-28 ([#898](https://github.com/getsentry/sentry-elixir/pull/898))
4+
15
# Changelog
26

37
## 10.10.0

lib/sentry/plug_context.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ defmodule Sentry.PlugContext do
155155

156156
@default_scrubbed_param_keys ["password", "passwd", "secret"]
157157
@default_scrubbed_header_keys ["authorization", "authentication", "cookie"]
158-
@credit_card_regex ~r/^(?:\d[ -]*?){13,16}$/
159158
@scrubbed_value "*********"
160159
@default_plug_request_id_header "x-request-id"
161160

@@ -277,7 +276,7 @@ defmodule Sentry.PlugContext do
277276
value =
278277
cond do
279278
key in scrubbed_keys -> @scrubbed_value
280-
is_binary(value) and value =~ @credit_card_regex -> @scrubbed_value
279+
is_binary(value) and value =~ credit_card_regex() -> @scrubbed_value
281280
is_struct(value) -> value |> Map.from_struct() |> scrub_map(scrubbed_keys)
282281
is_map(value) -> scrub_map(value, scrubbed_keys)
283282
is_list(value) -> scrub_list(value, scrubbed_keys)
@@ -298,4 +297,6 @@ defmodule Sentry.PlugContext do
298297
end
299298
end)
300299
end
300+
301+
defp credit_card_regex, do: ~r/^(?:\d[ -]*?){13,16}$/
301302
end

0 commit comments

Comments
 (0)