Giter Club home page Giter Club logo

pwned-passwords-django's Introduction

CI status image

pwned-passwords-django provides helpers for working with the Pwned Passwords database from Have I Been Pwned in Django powered sites. Pwned Passwords is an extremely large database of passwords known to have been compromised through data breaches, and is useful as a tool for rejecting common or weak passwords.

There are three main components to this application:

All three use a secure, anonymized API which never transmits any password or its full hash to any third party.

Usage

The recommended configuration is to enable both the validator and the automatic password-checking middleware. To do this, make the following changes to your Django settings.

First, add the validator to your AUTH_PASSWORD_VALIDATORS list:

AUTH_PASSWORD_VALIDATORS = [
    # ... other password validators ...
    {
        "NAME": "pwned_passwords_django.validators.PwnedPasswordsValidator",
    },
]

Then, add the middleware to your MIDDLEWARE list:

MIDDLEWARE = [
    # .. other middlewares ...
    "pwned_passwords_django.middleware.pwned_passwords_middleware",
]

For more details, consult the full documentation.

pwned-passwords-django's People

Contributors

davidcain avatar jdufresne avatar mic159 avatar stevenmapes avatar ubernostrum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwned-passwords-django's Issues

validators.py HELP_MESSAGE can be improved

12 +    HELP_MESSAGE = _("Your password can't be one which has been previously breached.")
12 -    HELP_MESSAGE = _("Your password can't be a commonly used password.")

By the way, fabulous software. Love it. Thank you :)

ValueError: invalid literal for int() with base 10: '//www.w3.org/TR/html4/strict.dtd">'

I'm using the following version, under Python 3.5:
pwned-passwords-django==1.1
django==1.11.13

Our prod monitoring just came through with the above error when we tried to verify someone's password, and the API came back with an HTML document starting with <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">, which made the password validator crash.

I cannot see the rest, but it looks like there was a small issue with the API at the time. I just retried the request manually, and the response is fine now.

Can I suggest to make the password validator a bit more resilient to API failures? If we fail to parse the response body, or if the response status code isn't 200, something went wrong and we should disable this validator.

Drop support for Python 3.7 and update minimum httpx

Since Python 3.7 is EOL and has been for a few months I think it's worth dropping support for it from this project and updating httpx to the latest 0.25 version which also drops Python 3.7 as well as including new additions and bug fixes. Hopefully httpx will also be updated soon to show support for Python 3.12 and httpcore version 1.0.0

Homepage link in pypi 404

The github/homepage link in pypi hits a 404 because the project name is incorrect.

url='http://github.com/ubernostrum/django-pwned-passwords/',

Wrong: http://github.com/ubernostrum/django-pwned-passwords/
Correct: https://github.com/ubernostrum/pwned-passwords-django/

Please consider fixing the link, and pointing to https, not http :)

Side note: maybe you could also consider updating the README to include a link to pypi? or a basic pip install line to help people go from Github -> pypi.

Add support for Django 3.1

Django 3.1 RC1 has been released. In advance of the release itself, it would be good to be able to test with the RC1.

I'll cut a branch for it and submit a PR.

Acceptable use policy - User Agent

I think the user-agent needs to be more specific than python-requests/{version} to comply with the acceptable use policy of the API.

Specifically:

Things that are not awesome include:

  • Not properly identifying the user agent such that it accurately describes the consumer of the API

See: https://haveibeenpwned.com/API/v2#UserAgent
See: https://haveibeenpwned.com/API/v2#AcceptableUse

I propose setting it to something like:
Django pwned password validator (https://github.com/ubernostrum/pwned-passwords-django)

It would be even more awesome if you can override it with a setting in the OPTIONS dictionary like in #5
That way people can set it to the name of their website, as they are the actual consumers of the API.

invalid literal for int() with base 10

I hit an issue this morning when testing offline when the value for "times" is more then 999. E.G. 3237 as times returns as 3,237

/site-packages/pwned_passwords_django/api.py, line 46, in _get_pwned

results[line_suffix] = int(times)

Make the request timeout configurable

We're consistently hitting the request timeout in production. Troy Hunt is investigating on his end why some of the requests are so slow - but it'd be useful to us if we could configure the request timeout for situations like this.

pwned-timeouts

Create 1.3.3 / 1.4 release

Hi there - it looks like pwned-passwords-django is now Django 3.0 compatible - is there any chance of an update to PyPI?

(sorry to badger, appreciate you may have other things going on)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.