﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36400	CommonPasswordValidator fails on plaintext list of common passwords	tpazderka		"As per [https://docs.djangoproject.com/en/5.1/topics/auth/passwords/#django.contrib.auth.password_validation.CommonPasswordValidator documentation], the file that is passed to the CommonPassowrodValidator can be either plaintext or gzipped.

We have been using plaintext version which worked previously, but stopped working after upgrade to `5.1.9` with the following stacktrace:

{{{
File ""/app/venv/lib/python3.13/site-packages/django/contrib/auth/password_validation.py"", line 237, in __init__                                                                                                    
    self.passwords = {x.strip() for x in f}                                                                                                                                                                          
                                         ^                                                                                                                                                                           
  File ""/usr/local/lib/python3.13/gzip.py"", line 353, in read1                                                                                                                                                       
    return self._buffer.read1(size)                                                                                                                                                                                  
           ~~~~~~~~~~~~~~~~~~^^^^^^                                                                                                                                                                                  
  File ""/usr/local/lib/python3.13/_compression.py"", line 68, in readinto                                                                                                                                             
    data = self.read(len(byte_view))                                                                                                                                                                                 
  File ""/usr/local/lib/python3.13/gzip.py"", line 546, in read                                                                                                                                                        
    if not self._read_gzip_header():                                                                                                                                                                                 
           ~~~~~~~~~~~~~~~~~~~~~~^^                                                                                                                                                                                  
  File ""/usr/local/lib/python3.13/gzip.py"", line 515, in _read_gzip_header                                                                                                                                           
    last_mtime = _read_gzip_header(self._fp)                                                                                                                                                                         
  File ""/usr/local/lib/python3.13/gzip.py"", line 475, in _read_gzip_header                                                                                                                                           
    raise BadGzipFile('Not a gzipped file (%r)' % magic)                                                                                                                                                             
gzip.BadGzipFile: Not a gzipped file (b'pa')
}}}

Taking the same file and running it through `gzip common-passwords.txt` fixes the issue.

Python version: 3.13.3
Django version: 5.1.9 "	Bug	closed	contrib.auth	5.1	Normal	needsinfo		tpazderka	Unreviewed	0	0	0	0	0	0
