Skip to content

fix(Cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler - #10555

Merged
paulbalandan merged 1 commit into
codeigniter4:developfrom
gr8man:fix/factories-cache-directory-permissions
Sep 18, 2026
Merged

paulbalandan merged 1 commit into
codeigniter4:developfrom
gr8man:fix/factories-cache-directory-permissions

Conversation

@gr8man

@gr8man gr8man commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Description
FileVarExportHandler::save() previously invoked @mkdir($this->path, 0777, true) when the cache directory did not exist. Passing 0777 grants full read/write/execute permissions to all users on systems with permissive umask settings (e.g. umask=0000 in Docker containers or shared hosting environments).

This PR changes the directory creation mode to 0755, consistent with existing CodeIgniter 4 practices (such as filesystem_helper and generator traits).

  • Updated FileVarExportHandler::save() directory creation mode to 0755.
  • Added regression unit test testSaveCreatesDirectoryWithCorrectPermissions() in FactoriesCacheFileVarExportHandlerTest.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated (Not applicable - security internal fix)
  • Conforms to style guide

Comment thread tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php
@gr8man
gr8man force-pushed the fix/factories-cache-directory-permissions branch from 3b9452e to db02754 Compare September 13, 2026 20:22
@carson-codeigniter4 carson-codeigniter4 Bot added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 13, 2026
Comment thread system/Cache/FactoriesCache/FileVarExportHandler.php
Comment thread tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php Outdated
@gr8man
gr8man force-pushed the fix/factories-cache-directory-permissions branch from db02754 to 11c8a16 Compare September 14, 2026 19:10
@paulbalandan paulbalandan changed the title fix(cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler fix(cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler Sep 18, 2026
@paulbalandan paulbalandan changed the title fix(cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler fix(Cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler Sep 18, 2026
@paulbalandan
paulbalandan merged commit 014c45c into codeigniter4:develop Sep 18, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants