Skip to content

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

Draft
vharseko wants to merge 1 commit into
masterfrom
alert-autofix-2093
Draft

vharseko wants to merge 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>
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