A file is made readable or writable by every user of the system
What it finds
file.setReadable(true, false) and setWritable(true, false) grant the permission to all users, not just the owner, and Android's MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE do the same for app files. Other users or apps can then read secrets or change data the program trusts.
From the rule's source, world_accessible_file.rs.
fun share(file: java.io.File, context: Context) { file.setReadable(true, false)tx0 reports: setReadable(true, false) grants the permission to every user file.setReadable(true, true) file.setWritable(true) context.openFileOutput("x", Context.MODE_WORLD_READABLE)tx0 reports: MODE_WORLD_READABLE lets every app access the file} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/kotlin:world-accessible-file" = "off"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/kotlin:world-accessible-file] reason="..."tx0 explain tx0/kotlin:world-accessible-file shows the same in the terminal. Found a false positive? Report it.