Skip to content

Alternative secure chmod for WireDatabaseBackup files #20

@hettiger

Description

@hettiger

Short description of the issue

Using $config->chmodFile for .sql files is a bad idea on some shared hosting environments.

Real world example

My Host recommends chmod 640 for .htaccess-, .html-, .txt and image files etc.
Therefore I've set $config->chmodFile = '0640';

When it comes to directories they suggest chmod 710.
Therefore I've set $config->chmodDir = '0710';

Now for PHP scripts (guess that also applies to SQL files) they suggest chmod 600.
Unfortunately I have not found any matching $config property for this case.

Conclusion

I think using chmod 640 for SQL files in this case is insecure and this needs to be fixed.

I'd even say ProcessDatabaseBackups, WireDatabaseBackup and all modules that rely on these must be considered insecure on shared hosting environments.

Solution

Make ProcessDatabaseBackups a ConfigurableModule.

OR

Introduce a new config property $config->chmodSensitiveFile and use this instead.

I think a new config property is better because of 3rd party modules that may rely on WireDatabaseBackup. (It may be helpful in other scenarios as well ...)

ProcessWire version: 3.0.35

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions