github-advanced-security[bot] commented on code in PR #15556:
URL:
https://github.com/apache/dolphinscheduler/pull/15556#discussion_r1475972222
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -363,21 +306,27 @@
}
}
- public static void createDirectoryIfNotPresent(Path path) throws
IOException {
- if (Files.exists(path)) {
- return;
- }
- Files.createDirectories(path);
- }
-
- /**
- * Create a file with '755'.
- */
public static void createFileWith755(@NonNull Path path) throws
IOException {
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
- Files.createFile(path, PERMISSION_755);
+ Files.createFile(path);
+ Files.setPosixFilePermissions(path, PERMISSION_755);
+ }
+ }
+
+ public static void createDirectoryWith755(@NonNull Path path) throws
IOException {
+ if (OSUtils.isWindows()) {
+ Files.createDirectories(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/3887)
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:
##########
@@ -363,21 +306,27 @@
}
}
- public static void createDirectoryIfNotPresent(Path path) throws
IOException {
- if (Files.exists(path)) {
- return;
- }
- Files.createDirectories(path);
- }
-
- /**
- * Create a file with '755'.
- */
public static void createFileWith755(@NonNull Path path) throws
IOException {
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
- Files.createFile(path, PERMISSION_755);
+ Files.createFile(path);
+ Files.setPosixFilePermissions(path, PERMISSION_755);
+ }
+ }
+
+ public static void createDirectoryWith755(@NonNull Path path) throws
IOException {
+ if (OSUtils.isWindows()) {
+ Files.createDirectories(path);
+ } else {
+ Path parent = path.getParent();
+ if (parent != null && !parent.toFile().exists()) {
+ createDirectoryWith755(parent);
+ }
+
+ 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/3888)
--
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]