Skip to content

Create directories that contain cache files so they are only owner accessible#359

Open
samdoran wants to merge 1 commit intograntjenks:masterfrom
samdoran:lockdown-cache-dirs
Open

Create directories that contain cache files so they are only owner accessible#359
samdoran wants to merge 1 commit intograntjenks:masterfrom
samdoran:lockdown-cache-dirs

Conversation

@samdoran
Copy link

@samdoran samdoran commented Mar 9, 2026

This aims to address CVE-2025-69872 by ensuring that parent directories containing the cache are not world readable. This is not a perfect solution but adds further mitigation.

The parent cache directory is created with tempfile.mkdtemp() which is only accessible by the creating user. The change in this PR only adds marginal additional security by ensuring the last intermediate directory created is accessible only by the creating user ID.

The core problem is that pickle should not be used when the source of the data is untrusted.

I experimented with a solution that created a hash of the pickle file then verified against that hash before unpicking, but that only seemed to move the problem. The hash needs to be stored somewhere and an attacker could update the hash at the same time the pickle itself is modified.

I would be happy to add clarification to the documentation if we feel that will help.

Changing the default to JSONDisk may be another possible solution, but that would be a breaking change.

Fixes #357

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.

Vulnerability CVE-2025-69872

1 participant