Skip to content

fix: secure temporary files and resource lookups - #19822

Open
FrankChen021 wants to merge 3 commits into
apache:masterfrom
FrankChen021:codex/codeql-warning-temp-lookup
Open

fix: secure temporary files and resource lookups#19822
FrankChen021 wants to merge 3 commits into
apache:masterfrom
FrankChen021:codex/codeql-warning-temp-lookup

Conversation

@FrankChen021

Copy link
Copy Markdown
Member

What

  • replace insecure default temporary-file creation with owner-private NIO or test-managed temporary locations
  • make test resource lookup use declaring-class literals and close resource streams
  • preserve portable getconf PATH lookup with a narrow CodeQL suppression and rationale
  • strengthen temporary archive cleanup in the OSS, S3, and Cassandra segment pushers

Why

This addresses the 55 CodeQL warnings in the temporary-file and resource-lookup group:

  • 46 java/local-temp-file-or-directory-information-disclosure
  • 8 java/unsafe-get-resource
  • 1 java/relative-path-command

Impact

Temporary files are created with restrictive permissions or inside managed private directories. Resource lookup no longer depends on runtime subclass dispatch, and affected tests can load resources when packaged in JARs.

Root cause

The affected code used legacy File.createTempFile, runtime-class resource lookup, and one intentionally portable executable lookup that CodeQL could not distinguish from an attacker-controlled command.

Checks

  • affected 21-module reactor test compilation and Checkstyle passed
  • production-focused tests: 24 passed
  • processing-focused tests: 174 passed
  • cross-module focused tests: 100 passed
  • git diff --check

Created by GPT-5.6-Sol.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants