A file is given permissions that let every user write to it

tx0/c:world-writable-moderecommendedwarningsecurity, cwe-732

What it finds

chmod(path, 0777) or umask(0): every user of the machine may then change the file, or every file the program creates. chmod is not limited by the umask, and umask(0) removes the limit for what follows.

The mode must be an integer literal with the bit for writing by others set.

From the rule's source, world_writable_mode.rs.

Example from the rule's tests
#include <sys/stat.h> void open_up(const char *path){  chmod(path, 0777);tx0 reports: chmod lets every user write to the file  chmod(path, 0755);  umask(0);tx0 reports: umask lets every user write to the file  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/c:world-writable-mode" = "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/c:world-writable-mode] reason="..."

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