elharo opened a new issue, #102:
URL: https://github.com/apache/maven-jarsigner/issues/102

   If the write to the `.unsigned` temp file succeeds but `Files.move()` fails 
(e.g. cross-device move on some filesystems, or permissions change between 
write and move), the user is left with the original signed jar plus an orphaned 
`.unsigned` file.
   
   **File:** `JarSignerUtil.java:76-105`
   
   **Suggested fix:** Clean up the `.unsigned` file in a `finally` block or 
catch block on exception:
   
   ```java
   Path unsignedPath = new File(jarFile.getAbsolutePath() + 
".unsigned").toPath();
   try {
       // ... existing write logic
       Files.move(unsignedPath, jarFile.toPath(), REPLACE_EXISTING);
   } catch (IOException e) {
       Files.deleteIfExists(unsignedPath);
       throw e;
   }
   ```


-- 
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]

Reply via email to