A file is given permissions that let every user write to it
What it finds
UnixFileMode.OtherWrite lets any account on the machine change the file, and so the configuration or code it holds. Permissions for the owner and, where needed, the group are enough for almost every file a program creates. The rule reports the flag where it is granted: in SetUnixFileMode, Directory.CreateDirectory and UnixCreateMode.
From the rule's source, world_writable_file_mode.rs.
using System.IO; class Files{ void Share(string path) { File.SetUnixFileMode(path, UnixFileMode.UserRead | UnixFileMode.OtherWrite);tx0 reports: every user may write to this file }} 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:
[rules]
"tx0/csharp:world-writable-file-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/csharp:world-writable-file-mode] reason="..."tx0 explain tx0/csharp:world-writable-file-mode shows the same in the terminal. Found a false positive? Report it.