From 83db1555233d219fe0d8642a16ef64fc127ada54 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Mon, 27 Jul 2026 13:22:06 +0000
Subject: [PATCH] Fix java/local-temp-file-or-directory-information-disclosure CodeQL alerts by using NIO temp file APIs (#763)
---
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java
index 6fe6ae3..a9704c2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -13,6 +13,7 @@
*
* Copyright 2006-2009 Sun Microsystems, Inc.
* Portions Copyright 2012-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.tools;
@@ -28,6 +29,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
import java.security.MessageDigest;
import java.security.PrivilegedExceptionAction;
import java.security.SecureRandom;
@@ -1892,7 +1894,7 @@
String configFileName;
try
{
- File tempFile = File.createTempFile("login", "conf");
+ File tempFile = Files.createTempFile("login", "conf").toFile();
configFileName = tempFile.getAbsolutePath();
tempFile.deleteOnExit();
try (BufferedWriter w = new BufferedWriter(new FileWriter(tempFile, false))) {
--
Gitblit v1.10.0