From 40b9a738597c58f7e88bc8d407560fa2f733fd39 Mon Sep 17 00:00:00 2001 From: Andre Neto Date: Thu, 8 Oct 2026 14:04:09 +0100 Subject: [PATCH] ISR: read DB password from ISR_DB_PASSWORD; untrack compiled bytecode 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. --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1199dbe --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# 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: + +```bash +export ISR_DB_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`.