Skip to content

Commit c1556b2

Browse files
committed
👌 sanitize serviceId in checklistservice
1 parent a2b863e commit c1556b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

personalization-service/src/main/java/de/muenchen/dbs/personalization/checklist/ChecklistService.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import lombok.RequiredArgsConstructor;
1313
import lombok.extern.slf4j.Slf4j;
1414
import org.apache.commons.lang3.StringUtils;
15+
import org.apache.commons.text.StringEscapeUtils;
1516
import org.springframework.http.HttpStatus;
1617
import org.springframework.security.core.Authentication;
1718
import org.springframework.security.core.context.SecurityContextHolder;
@@ -74,13 +75,14 @@ public void deleteChecklist(final UUID checklistId) {
7475

7576
public Checklist changeChecklistEntry(final UUID checklistId, final String serviceId, ZonedDateTime newCheckedValue) {
7677
final String lhmExtId = getLhmExtIdFromAuthenticationOrThrow();
77-
log.debug("Update checklist with checklist-ID {} and service-ID {} for {}", checklistId, serviceId, lhmExtId);
78+
final String sanitizedServiceId = StringEscapeUtils.escapeHtml4(serviceId);
79+
log.debug("Update checklist with checklist-ID {} and service-ID {} for {}", checklistId, sanitizedServiceId, lhmExtId);
7880
final Checklist foundChecklist = getChecklistOrThrowException(checklistId);
7981

8082
isChecklistOwnerOrThrow(foundChecklist, lhmExtId);
8183

82-
foundChecklist.getChecklistItems().stream().forEach(checklistItem -> {
83-
if(checklistItem.getServiceID().equals(serviceId)) {
84+
foundChecklist.getChecklistItems().forEach(checklistItem -> {
85+
if(checklistItem.getServiceID().equals(sanitizedServiceId)) {
8486
checklistItem.setChecked(newCheckedValue);
8587
}
8688
});

0 commit comments

Comments
 (0)