Skip to content

Commit d0c3e49

Browse files
Added sanitized url at logs
1 parent 84efa97 commit d0c3e49

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/uk/gov/hmcts/cp/subscription/controllers/SubscriptionController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.RequiredArgsConstructor;
44
import lombok.extern.slf4j.Slf4j;
5+
import org.jspecify.annotations.Nullable;
56
import org.springframework.http.HttpStatus;
67
import org.springframework.http.ResponseEntity;
78
import org.springframework.transaction.annotation.Transactional;
@@ -27,12 +28,16 @@ public class SubscriptionController implements SubscriptionApi {
2728
@Transactional
2829
public ResponseEntity<ClientSubscription> createClientSubscription(final String callbackUrl,
2930
final CreateClientSubscriptionRequest request) {
30-
log.info("createClientSubscription callbackUrl:{} clientId:{}", callbackUrl, CLIENT_ID);
31+
log.info("createClientSubscription callbackUrl:{} clientId:{}", getSanitizedCallbackUrl(callbackUrl), CLIENT_ID);
3132
final ClientSubscription response = subscriptionService.saveSubscription(callbackUrl, request);
3233
log.info("createClientSubscription created subscription:{}", response.getClientSubscriptionId());
3334
return new ResponseEntity<>(response, HttpStatus.CREATED);
3435
}
3536

37+
private static @Nullable String getSanitizedCallbackUrl(final String callbackUrl) {
38+
return callbackUrl == null ? null : callbackUrl.replace("\r", " ").replace("\n", " ");
39+
}
40+
3641
@Override
3742
@Transactional
3843
public ResponseEntity<ClientSubscription> updateClientSubscription(final UUID clientSubscriptionId,

0 commit comments

Comments
 (0)