Skip to content

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

Open
gr8man wants to merge 2 commits into
codeigniter4:developfrom
gr8man:fix/factories-cache-directory-permissions
Open

fix(cache): set secure 0755 permissions mode when creating directory in FileVarExportHandler#10555
gr8man wants to merge 2 commits 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

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