A password-based key is derived with fewer than 10,000 iterations
What it finds
The iteration count of PBEKeySpec is what makes guessing passwords from a derived key slow. Counts in the hundreds or thousands are cheap to brute-force with current hardware; current guidance for PBKDF2 asks for hundreds of thousands.
From the rule's source, weak_key_derivation.rs.
fun derive(password: CharArray, salt: ByteArray) { val weak = PBEKeySpec(password, salt, 1000, 256)tx0 reports: 1000 iterations make the derived key cheap to brute-force val strong = PBEKeySpec(password, salt, 600_000, 256)} 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:few-key-derivation-iterations" = "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:few-key-derivation-iterations] reason="..."tx0 explain tx0/kotlin:few-key-derivation-iterations shows the same in the terminal. Found a false positive? Report it.