A temporary file or directory is created with kotlin.io's createTempFile or createTempDir, which use default permissions
What it finds
createTempFile() and createTempDir() of kotlin.io are deprecated because the file they create may be readable by other users of the system. kotlin.io.path.createTempFile and createTempDirectory use restrictive permissions.
From the rule's source, insecure_temp_file.rs.
fun scratch() { val file = createTempFile("data")tx0 reports: createTempFile of kotlin.io may create a file other users can read val dir = createTempDir()tx0 reports: createTempDir of kotlin.io val safe = File.createTempFile("data", ".tmp")} 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/kotlin:insecure-temp-file" = "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/kotlin:insecure-temp-file] reason="..."tx0 explain tx0/kotlin:insecure-temp-file shows the same in the terminal. Found a false positive? Report it.