pre_processing.py hard-coded the PostgreSQL password in the connection URL. It now reads ISR_DB_PASSWORD and raises RuntimeError when it is unset. metrics/subjective/__pycache__/pre_processing.cpython-310.pyc embedded the same password as a compiled string literal. .gitignore already lists __pycache__/ and *.pyc, but 21 bytecode files were tracked regardless; they are now removed from the index (git rm --cached, the files stay on disk). Why: neither the source nor a compiled copy of the credential may live in the repository. The value is still in the history, so it must be rotated.
813 B
813 B
ISR
Configuration
The PostgreSQL password is not stored in the code.
metrics/subjective/pre_processing.py reads it from the environment
variable ISR_DB_PASSWORD and builds database_url from it:
export ISR_DB_PASSWORD='<your-database-password>'
python metrics/subjective/pre_processing.py
If the variable is missing the script stops with a RuntimeError;
there is no default and no silent None. Any password that was
ever pushed to this repository must be rotated.
Note: the repository still tracks the compiled bytecode
metrics/subjective/__pycache__/pre_processing.cpython-310.pyc, which
contains the old password. Remove it (git rm) and run with
PYTHONDONTWRITEBYTECODE=1 until it is gone; the code patch cannot
delete that binary file without breaking git apply.