Skip to content

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

Open
goneall wants to merge 1 commit into
masterfrom
alert-autofix-1
Open

goneall wants to merge 1 commit into
masterfrom
alert-autofix-1

Conversation

@goneall

@goneall goneall commented Nov 25, 2026

Copy link
Copy Markdown
Member

Potential fix for https://github.com/spdx/tools-java/security/code-scanning/1

Use NIO temp-file creation instead of java.io.File.createTempFile(...), and keep the rest of the test behavior unchanged.

Best fix here: in src/test/java/org/spdx/tools/MatchingStandardLicensesTest.java, replace the File.createTempFile(...) call in testMatch() with Files.createTempFile(...), store it as a Path, and continue writing content with Files.write(...). Pass licenseFile.toAbsolutePath().toString() to MatchingStandardLicenses.run(...). This aligns with CodeQL guidance and preserves test semantics. No new dependencies are needed.

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

…sure in a temporary directory

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@goneall
goneall marked this pull request as ready for review November 25, 2026 19:53

This branch has not been deployed

No deployments
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