一个django密码验证器,它检查troy hunt的pwned密码api,以查看密码以前是否涉及重大安全漏洞。
django-pwned-passwords的Python项目详细描述
django pwned password s是一个django密码验证器,它检查troy hunt的pwned passwords api,以查看密码之前是否涉及重大安全漏洞。
注意:此应用程序当前将用户的哈希密码的一部分发送给第三方。在使用此应用程序之前,您应该了解它对您的影响。
要求
- Django[1.9,2.1]
- Python2.7,[3.5,3.6,3.7]
快速启动
安装django pwned密码:
pip install django-pwned-passwords
将其添加到已安装的应用程序中
INSTALLED_APPS=(...'django_pwned_passwords',...)
添加django pwned passwords的pwnedpasswordvalidator:
AUTH_PASSWORD_VALIDATORS=[...{'NAME':'django_pwned_passwords.password_validation.PWNEDPasswordValidator'}]
功能
如果pwned passwords api
检测其数据集中的密码。注意,api的速率非常有限,
所以有一个超时(PWNED_VALIDATOR_TIMEOUT
)。
如果PWNED_VALIDATOR_FAIL_SAFE
是真的,那么除了api之外的任何东西都会识别出错误的密码
将通过,包括超时。如果PWNED_VALIDATOR_FAIL_SAFE
为false,则
此外,一个好的密码将失败并引发validationerror。
设置
Setting | Description | Default |
^{ | The timeout in seconds. The validator will not wait longer than this for a response from the API. | ^{ |
^{ | If the API fails to get a valid response, should we fail safe and allow the password through? | ^{ |
^{ | The URL for the API in a string format. | ^{ |
^{ | The error message for an invalid password. | ^{ |
^{ | The error message when the API fails. Note: this will only display if ^{ | ^{ |
^{ | The help text for this password validator. | ^{ |
^{ | The minimum number of breaches needed to raise an error | ^{ |
速率限制
历史上,对api的请求速率是有限的。然而,新的基于k-匿名模型的api没有这样的速率限制。
运行测试
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
历史记录
请参见github版本