Skip to content

Temporary files created with a predictable name and without exclusive creation #343

Closed

Description

@njoubert-cleverage

Several temporary files are created in the system temporary directory with a predictable name and without exclusive creation:

  • FileSplitterTask (file_splitter): php_<uniqid>.tmp, opened with wb;
  • CsvSplitterTask (csv_splitter): php_<uniqid>.csv, opened with wb+;
  • SubprocessInstance (JSON buffer of ProcessLauncherTask with json_buffering): cdm_buffer_<uniqid>.json-stream, written by the sub-process.

uniqid() is derived from the current time; fopen() with w follows an existing symbolic link and truncates its target; the files get the permissions of the umask (usually readable by every user). On a shared host, another user can read the data of the split files and buffers, or make the process write into another file by creating a symbolic link with the expected name.

Fix: create these files with a random name (random_bytes()), exclusively (fopen() mode x, which fails on an existing path, symbolic links included) and readable by their owner only (0600), through a new internal TemporaryFile helper.

Found during the global audit after the 5.4 release (process-bundle-audit.md #87).

Activity

  1. added 2 commits that reference this issue on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions