Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,13 @@
*/
'data-fingerprint' => '',

/**
* config.php file mode in octal notation.
*
* Defaults to ``0640`` (writable by user, readable by group).
*/
'configfilemode' => 0640,
Comment on lines +2617 to +2621
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming and format is a copy of logfilemode for the log file, so I'd rather stick with that.


/**
* This entry serves as a warning if the sample configuration was copied.
* DO NOT ADD THIS TO YOUR CONFIGURATION!
Expand Down
5 changes: 3 additions & 2 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@ private function writeData(): void {
touch($this->configFilePath);
$filePointer = fopen($this->configFilePath, 'r+');

// Prevent others not to read the config
chmod($this->configFilePath, 0640);
// Apply permissions for config.php, defaulting to user read-write and group read
$permissions = $this->cache['configfilemode'] ?? 0640;
chmod($this->configFilePath, $permissions);

// File does not exist, this can happen when doing a fresh install
if (!is_resource($filePointer)) {
Expand Down
Loading