From 5328df8ec8c2d6db2b4c92cc20185a9ccfebbe44 Mon Sep 17 00:00:00 2001 From: shlurbee Date: Tue, 2 Oct 2012 11:48:47 -0700 Subject: [PATCH] Clean AuthorizeNetException message Removes credit card number from exception error message to make sure it doesn't show up in logs --- r2/r2/lib/authorize/api.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/r2/r2/lib/authorize/api.py b/r2/r2/lib/authorize/api.py index 69319a2c4..ecd88874f 100644 --- a/r2/r2/lib/authorize/api.py +++ b/r2/r2/lib/authorize/api.py @@ -48,7 +48,16 @@ Errors = Storage(TESTMODE = "E00009", TOO_MANY_SHIP_ADDRESSES = "E00043") class AuthorizeNetException(Exception): - pass + def __init__(self, msg): + # don't let CC info show up in logs + msg = re.sub("\d+(\d{4})", + "...\g<1>", + msg) + msg = re.sub("\d+", + "omitted", + msg) + super(AuthorizeNetException, self).__init__(msg) + # xml tags whose content shouldn't be escaped