Skip to content

Commit

Permalink
doc: password compromission details
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Nov 21, 2024
1 parent 12d7bfd commit 3ecda0c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
5 changes: 4 additions & 1 deletion canaille/app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def compromised_password_validator(form, field):
hashed_password[5:].upper(),
)

api_url = current_app.config["CANAILLE"]["API_URL_HIBP"] + hashed_password_prefix
api_url = (
current_app.config["CANAILLE"]["PASSWORD_COMPROMISSION_CHECK_API_URL"]
+ hashed_password_prefix
)

try:
response = requests.api.get(api_url, timeout=10)
Expand Down
15 changes: 5 additions & 10 deletions canaille/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,9 @@ class = "logging.handlers.WatchedFileHandler"
"""

ENABLE_PASSWORD_COMPROMISSION_CHECK: bool = False
"""If :py:data:`True`, Canaille will check for password compromise on HIBP
every time a new password is register.
"""If :py:data:`True`, Canaille will check if passwords appears in
compromission databases such as `HIBP <https://haveibeenpwned.com>`_
when users choose a new one."""

(https://haveibeenpwned.com/)
"""

API_URL_HIBP: str = "https://api.pwnedpasswords.com/range/"
"""Have i been pwned api url for compromission checks.
This url should not be modified.
"""
PASSWORD_COMPROMISSION_CHECK_API_URL: str = "https://api.pwnedpasswords.com/range/"
"""Have i been pwned api url for compromission checks."""
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def configuration(smtpd):
"disable_existing_loggers": False,
},
"ADMIN_EMAIL": "[email protected]",
"API_URL_HIBP": "https://api.pwnedpasswords.test/range/",
"PASSWORD_COMPROMISSION_CHECK_API_URL": "https://api.pwnedpasswords.test/range/",
},
}
return conf
Expand Down

0 comments on commit 3ecda0c

Please sign in to comment.