Skip to content

Commit

Permalink
vuln-fix: Partial Path Traversal Vulnerability (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLLeitschuh authored Aug 8, 2022
1 parent fe24abe commit 7b9517b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private FormValidation doCheckTestFrameWorkPath(String value) {
}
try {
File file = new File(basePath, value);
if (file.getCanonicalPath().startsWith(basePath)) {
if (file.getCanonicalFile().toPath().startsWith(basePath)) {
return FormValidation.ok();
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private AttachmentModel addAttachments(ParameterModel parameter, String jwtToken
for (String s : logDir) {
String trimPath = s.trim();
File file = new File(workspaceBasePath, trimPath);
if (!StringUtils.isBlank(trimPath) && file.getCanonicalPath().startsWith(workspaceBasePath)) {
if (!StringUtils.isBlank(trimPath) && file.getCanonicalFile().toPath().startsWith(workspaceBasePath)) {
String logPath = file.getAbsolutePath();
AttachmentModel reportFiles = attachLogFiles(buildTriggerTime, workspaceBasePath, logPath, issueKey, jwtToken, "", "Other Files", true);
uploadedFileNames.addAll(reportFiles.getAttachments());
Expand Down

0 comments on commit 7b9517b

Please sign in to comment.