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

Commit

Permalink
DD-1459 Fix uncontrolled data used in path expression - Test 2A
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Sheikhi committed Apr 2, 2024
1 parent ced6bf4 commit c373f22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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 @@ -46,6 +46,7 @@ public ImportsResource(ImportArea importArea) {
public Response startImport(StartImport start) {
log.debug("Received command = {}", start);
String batchName;
importArea.checkBaseFolderSecurity(start.getInputPath());
try {
batchName = importArea.startImport(start.getInputPath(), start.isBatch(), start.isContinue());
}
Expand Down

0 comments on commit c373f22

Please sign in to comment.