Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
23b2aa0
Add initial logging to Event.java
Aug 29, 2025
5c30c66
Update Event.java logging
Aug 29, 2025
96cd981
Add logging to CaseDetails.java and CaseDataContent.java
Sep 1, 2025
143eeb3
Revert Add logging to CaseDetails.java and CaseDataContent.java
Sep 1, 2025
d6b3cc8
Revert Add logging to CaseDetails.java and CaseDataContent.java (2)
Sep 1, 2025
2edd160
Merge branch 'master' into CCD-6117-investigate-redacting-event-descr…
JamesCollettCGI Sep 1, 2025
1f89cf4
Minor changes to CaseDetails.java and CaseDataContent.java
Sep 1, 2025
abba32e
Minir changes
Sep 1, 2025
93bfd66
Update JcLogger.java
Sep 3, 2025
87da5e1
Add logging to CaseDetails.java and CaseDataContent.java
Sep 3, 2025
cb6245b
Update logging , CaseDetails.java and CaseDataContent.java
Sep 3, 2025
ea5aa9d
Add prototype Redactor for Event descriptions
Sep 3, 2025
a22e7c9
Fix checkstyle
Sep 3, 2025
123553c
Apply description @JsonProperty to getDescription() and setDescription()
Sep 4, 2025
ddf3eea
Fix checkstyle
Sep 4, 2025
35f26d0
Update EventDescriptionRedactor.java
Sep 4, 2025
7cb0e31
Merge branch 'master' into CCD-6117-investigate-redacting-event-descr…
JamesCollettCGI Sep 4, 2025
0cf5009
Temporary change to build.gradle
Sep 4, 2025
4c8d873
Updates (build #25)
Sep 4, 2025
14c155f
Sonar temporary exclude EventDescriptionRedactor.java
Sep 4, 2025
32bd237
Add logging to EmailValidator , to check how CaseFieldDefinition is p…
Sep 4, 2025
399f52f
Updates to EventDescriptionRedactor.java and Event.java (build #28)
Sep 4, 2025
3f63911
Update EventDescriptionRedactor.java
Sep 4, 2025
ac9b9b6
Update to EventDescriptionRedactor.java
Sep 4, 2025
3578856
Updates to logging
Sep 5, 2025
679328d
Add logging to EventDescriptionRedactor (and BaseType) to investigate…
Sep 5, 2025
da822a1
Fix checkstyle
Sep 5, 2025
dd8525d
Temporary exclude BaseType.java while logging enabled
Sep 5, 2025
1840a58
Backup EventDescriptionRedactor.java before cleaning EventDescription…
Sep 5, 2025
c3cc10c
Clean up EventDescriptionRedactor.java. Might fail Sonar coverage as…
Sep 5, 2025
07cfd4f
Cleanup
Sep 5, 2025
f2364b7
Cleanup 2
Sep 5, 2025
d54f2ac
Updates to EventDescriptionRedactor.java and EventDescriptionRedactor…
Sep 8, 2025
899a0ae
SuppressWarning S5852
Sep 8, 2025
15441d7
Add redaction to Event summary (as well as Event description)
Sep 17, 2025
7aa34be
Update com.jayway.jsonpath to 2.9.0
Sep 17, 2025
3400ec3
Merge branch 'master' into CCD-6117-investigate-redacting-event-descr…
RebeccaBaker Oct 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ dependencies {
implementation group: 'commons-validator', name: 'commons-validator', version: '1.6'
// CVE-2019-10086 force update of commons-beanutils.
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.9.0'
implementation group: 'org.awaitility', name: 'awaitility', version: '3.1.6'

// CVE-2021-28170
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/uk/gov/hmcts/ccd/domain/model/std/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.ToString;
import uk.gov.hmcts.ccd.util.EventDescriptionRedactor;

@ToString
public class Event {
@JsonProperty("id")
private String eventId;
@JsonProperty("summary")

private String summary;
@JsonProperty("description")

private String description;

private final EventDescriptionRedactor redactor = new EventDescriptionRedactor();

public String getEventId() {
return eventId;
}
Expand All @@ -20,18 +23,22 @@ public void setEventId(String eventId) {
this.eventId = eventId;
}

@JsonProperty("summary")
public String getSummary() {
return summary;
return redactor.redact(summary);
}

@JsonProperty("summary")
public void setSummary(String summary) {
this.summary = summary;
}

@JsonProperty("description")
public String getDescription() {
return description;
return redactor.redact(description);
}

@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/uk/gov/hmcts/ccd/util/EventDescriptionRedactor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package uk.gov.hmcts.ccd.util;

@SuppressWarnings("squid:S5852")
public class EventDescriptionRedactor {
private static final String EMAIL_PATTERN = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,10}";

public String redact(final String description) {
if (description == null) {
return null;
} else {
return description.replaceAll(EMAIL_PATTERN, "[REDACTED EMAIL]");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package uk.gov.hmcts.ccd.util;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

class EventDescriptionRedactorTest {

private final EventDescriptionRedactor redactor = new EventDescriptionRedactor();

@Test
void shouldReturnNullIfInputIsNull() {
assertNull(redactor.redact(null));
}

@ParameterizedTest
@CsvSource({
"Plain text, Plain text",
"Contact me at john.doe@example.com for details, Contact me at [REDACTED EMAIL] for details",
"Emails: alice@example.com; bob.smith@domain.co.uk, Emails: [REDACTED EMAIL]; [REDACTED EMAIL]"
})
void testRedactor(String input, String expected) {
assertEquals(expected, redactor.redact(input));
}
}