mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-23 15:21:25 +01:00
Hardening suggestions for Stirling-PDF / fix-sig-logo (#2144)
Modernize and secure temp file creation Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
This commit is contained in:
parent
9e597a4390
commit
b094634799
@ -8,6 +8,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.KeyStoreException;
|
import java.security.KeyStoreException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@ -104,7 +105,7 @@ public class CertSignController {
|
|||||||
super(keystore, pin);
|
super(keystore, pin);
|
||||||
ClassPathResource resource = new ClassPathResource("static/images/signature.png");
|
ClassPathResource resource = new ClassPathResource("static/images/signature.png");
|
||||||
try (InputStream is = resource.getInputStream()) {
|
try (InputStream is = resource.getInputStream()) {
|
||||||
logoFile = File.createTempFile("signature", ".png");
|
logoFile = Files.createTempFile("signature", ".png").toFile();
|
||||||
FileUtils.copyInputStreamToFile(is, logoFile);
|
FileUtils.copyInputStreamToFile(is, logoFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("Failed to load image signature file");
|
logger.error("Failed to load image signature file");
|
||||||
|
Loading…
Reference in New Issue
Block a user