github-advanced-security[bot] commented on code in PR #16923:
URL:
https://github.com/apache/dolphinscheduler/pull/16923#discussion_r1905130957
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -289,6 +268,29 @@
}
}
+ public static void createDirectoryWithPermission(@NonNull Path path,
+ @NonNull
Set<PosixFilePermission> permissions) throws IOException {
+ if (path.toFile().exists()) {
Review Comment:
## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5132)
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -289,6 +268,29 @@
}
}
+ public static void createDirectoryWithPermission(@NonNull Path path,
+ @NonNull
Set<PosixFilePermission> permissions) throws IOException {
+ if (path.toFile().exists()) {
+ return;
+ }
+
+ if (OSUtils.isWindows()) {
+ Files.createDirectories(path);
+ } else {
+ Path parent = path.getParent();
+ if (parent != null && !parent.toFile().exists()) {
Review Comment:
## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5133)
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -289,6 +268,29 @@
}
}
+ public static void createDirectoryWithPermission(@NonNull Path path,
+ @NonNull
Set<PosixFilePermission> permissions) throws IOException {
+ if (path.toFile().exists()) {
+ return;
+ }
+
+ if (OSUtils.isWindows()) {
+ Files.createDirectories(path);
+ } else {
+ Path parent = path.getParent();
+ if (parent != null && !parent.toFile().exists()) {
+ createDirectoryWithPermission(parent, permissions);
+ }
+
+ try {
+ Files.createDirectory(path);
Review Comment:
## Uncontrolled data used in path expression
This path depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5134)
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -289,6 +268,29 @@
}
}
+ public static void createDirectoryWithPermission(@NonNull Path path,
+ @NonNull
Set<PosixFilePermission> permissions) throws IOException {
+ if (path.toFile().exists()) {
+ return;
+ }
+
+ if (OSUtils.isWindows()) {
+ Files.createDirectories(path);
+ } else {
+ Path parent = path.getParent();
+ if (parent != null && !parent.toFile().exists()) {
+ createDirectoryWithPermission(parent, permissions);
+ }
+
+ try {
+ Files.createDirectory(path);
+ Files.setPosixFilePermissions(path, permissions);
+ } catch (FileAlreadyExistsException fileAlreadyExistsException) {
+ log.error("The directory: {} already exists", path);
Review Comment:
## Log Injection
This log entry depends on a [user-provided value](1).
[Show more
details](https://github.com/apache/dolphinscheduler/security/code-scanning/5145)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]