Data is encrypted with an initialization vector fixed in the code
What it finds
Data is encrypted with an initialization vector fixed in the code
<?php$a = openssl_encrypt($data, 'aes-256-cbc', $key, 0, '1234567890123456');tx0 reports: the initialization vector is the same for every message$b = openssl_encrypt($data, 'aes-256-cbc', $key, 0, str_repeat("\0", 16));tx0 reports: the initialization vector is the same for every message$iv = random_bytes(openssl_cipher_iv_length('aes-256-cbc'));$c = openssl_encrypt($data, 'aes-256-cbc', $key, 0, $iv); 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/php:static-initialization-vector" = "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/php:static-initialization-vector] reason="..."tx0 explain tx0/php:static-initialization-vector shows the same in the terminal. Found a false positive? Report it.