From 40f265ca6befc37e932a98b718f1a279f2fb2803 Mon Sep 17 00:00:00 2001 From: stigus Date: Wed, 20 Nov 2024 09:31:19 +0100 Subject: [PATCH 1/2] * Fjerner bearer token som persisteres til logg gjennom instrumentering #deploy-proxy-pensjon --- .../logging/TestnavLogbackEncoder.java | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java index 67acbbe5fe..a83cd66859 100644 --- a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java +++ b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java @@ -33,8 +33,8 @@ public class TestnavLogbackEncoder extends LogstashEncoder { // matches exactly 11 digits (\\d{11}) that are not immediately preceded ((? { + if (match.group().charAt(2) == '0' || match.group().charAt(2) == '1') { + return match.group().substring(0, 6) + "xxxxx"; } - } - matcher.appendTail(result); + return match.group(); + }); + + message = bearer.matcher(message).replaceAll("REDACTED_AUTH_HEADER"); - return result.toString(); + return message; } } \ No newline at end of file From 33873afc967d1a076007a01351ef4281ff1cbcf4 Mon Sep 17 00:00:00 2001 From: stigus Date: Wed, 20 Nov 2024 10:11:40 +0100 Subject: [PATCH 2/2] * Fjerner bearer token som persisteres til logg gjennom instrumentering #deploy-proxy-pensjon --- .../libs/reactivecore/logging/TestnavLogbackEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java index a83cd66859..3f43eac0b0 100644 --- a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java +++ b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/logging/TestnavLogbackEncoder.java @@ -120,7 +120,7 @@ private String formatMessage(String message) { return match.group(); }); - message = bearer.matcher(message).replaceAll("REDACTED_AUTH_HEADER"); + message = bearer.matcher(message).replaceAll("REDACTED_BEARER"); return message; }