A file is made writable by every user

tx0/php:world-writable-permissionrecommendedwarningsecurity/filesdepth fastsecurity, cwe-732

What it finds

chmod($file, 0777) and umask(0): permissions that let every user of the machine write a file let any other program or account change it, including code that the application later runs.

From the rule's source, world_writable_permission.rs.

Example from the rule's tests
<?phpfunction prepare($file){    chmod($file, 0777);tx0 reports: chmod sets the mode 777, which every user can write    umask(0);tx0 reports: this umask lets new files be written by every user    chmod($file, 0644);    umask(022);}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/php:world-writable-permission" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:world-writable-permission] reason="..."

tx0 explain tx0/php:world-writable-permission shows the same in the terminal. Found a false positive? Report it.