Skip to content

Potential fix for code scanning alert no. 2093: Local information disclosure in a temporary directory - #312

Merged
vharseko merged 1 commit into
masterfrom
alert-autofix-2093
Sep 28, 2026
Merged

vharseko merged 1 commit into
masterfrom
alert-autofix-2093

Conversation

@vharseko

Copy link
Copy Markdown
Member

Potential fix for https://github.com/OpenIdentityPlatform/commons/security/code-scanning/2093

Use NIO temp-file creation instead of java.io.File.createTempFile(...).

Best fix without changing functionality:

  • In generatePomFile(...), replace the insecure temp file creation call with java.nio.file.Files.createTempFile(...).
  • Convert the resulting Path back to File (toFile()) so the rest of the method remains unchanged.
  • Add required imports for java.nio.file.Files and java.nio.file.Path.

This keeps behavior the same (still returns File, still writes via WriterFactory) while using the safer API recommended by the rule.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…closure in a temporary directory

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@vharseko
vharseko marked this pull request as ready for review September 28, 2026 17:02
@vharseko
vharseko merged commit ff0d4dd into master Sep 28, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant