Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

DD-1459 Fix uncontrolled data used in path expression - Test 1A #127

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ protected void initOutbox(Path outbox, boolean allowNonEmpty) {
throw new IllegalArgumentException("cannot initialize outbox for batch at " + outbox, e);
}
}

public void checkBaseFolderSecurity(Path path) throws RuntimeException {
Path toCheckPath = path.normalize().toAbsolutePath();
if (!toCheckPath.startsWith(this.inboxDir)) {
throw new IllegalArgumentException(String.format("InsecurePath %s", toCheckPath));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Response startImport(StartImport start) {
log.debug("Received command = {}", start);
String batchName;
try {
importArea.checkBaseFolderSecurity(start.getInputPath());
batchName = importArea.startImport(start.getInputPath(), start.isBatch(), start.isContinue());
}
catch (IllegalArgumentException e) {
Expand Down
Loading