suspicious-insecure-cipher-usage (S304)
源自 flake8-bandit linter。
作用
检查弱或已损坏的密码的使用。
为什么这不好?
弱或已损坏的密码可能容易受到攻击,允许攻击者在不知道密钥的情况下解密密文,或以其他方式危及密码的安全性,例如伪造。
使用强大、现代的密码,而不是弱或已损坏的密码。
在预览中,此规则还会标记对不安全密码的引用。
示例
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms
algorithm = algorithms.ARC4(key)
cipher = Cipher(algorithm, mode=None)
encryptor = cipher.encryptor()
建议改为