-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge dev in uat #192
merge dev in uat #192
Conversation
# Conflicts: # helm-chart/Chart.yaml # pom.xml
# Conflicts: # _TMP/coverage-results.md # helm-chart/Chart.yaml # pom.xml # src/main/java/it/gov/pagopa/atmlayer/service/model/utils/FileUtilities.java # src/test/resources/integration-test/output/result.html # src/test/resources/integration-test/output/result.json
# Conflicts: # _TMP/coverage-results.md # helm-chart/Chart.yaml # pom.xml # src/main/java/it/gov/pagopa/atmlayer/service/model/utils/FileUtilities.java # src/test/resources/integration-test/output/result.html # src/test/resources/integration-test/output/result.json
|
||
@Startup | ||
static void init(@Observes StartupEvent ev) throws IOException { | ||
String secureDirPath = System.getProperty("java.io.tmpdir") + "/decodedFilesDirectory"; |
Check warning
Code scanning / CodeQL
Local information disclosure in a temporary directory Medium
system temp directory
Local information disclosure vulnerability from
system temp directory
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we should use the java.nio.file.Files.createTempDirectory
method, which allows us to create a temporary directory with secure permissions from the start. This method ensures that the directory is created with permissions that restrict access to the owner only, thus preventing local information disclosure.
Steps to fix:
- Replace the use of
new File
andmkdirs()
withFiles.createTempDirectory
. - Ensure that the directory is created with secure permissions from the start.
- Update the
decodedFilesDirectory
to use the path returned byFiles.createTempDirectory
.
-
Copy modified line R27
@@ -26,7 +26,3 @@ | ||
static void init(@Observes StartupEvent ev) throws IOException { | ||
String secureDirPath = System.getProperty("java.io.tmpdir") + "/decodedFilesDirectory"; | ||
decodedFilesDirectory = new File(secureDirPath); | ||
if (!decodedFilesDirectory.exists() && !decodedFilesDirectory.mkdirs()) { | ||
throw new IOException("Impossibile creare una directory sicura per il salvataggio di file temporanei."); | ||
} | ||
decodedFilesDirectory = java.nio.file.Files.createTempDirectory("decodedFilesDirectory").toFile(); | ||
if (SystemUtils.IS_OS_UNIX) { |
jacoco
|
No description provided.