From c2a253071e074a1df35504cff2e656a724504dc4 Mon Sep 17 00:00:00 2001 From: Andre Neto Date: Thu, 8 Oct 2026 14:03:21 +0100 Subject: [PATCH] Netflox: read DB password from env; stop tracking archive with old password database.py had the PostgreSQL password in plain text (inline literal repeated in every psycopg2.connect call). It now reads NETFLOX_DB_PASSWORD once at import time and raises RuntimeError if it is unset, so there is no default. The committed Projeto_Netflox_*.zip embeds the same database.py and therefore still carries the old password, so it is removed from the index (git rm --cached; the file stays on disk outside the working tree). README.md documents the env var and the archive removal. Why: the credential must not live in the repository. The value is still in the history and in any clone/cache, so it must be rotated. --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..17e147c --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Netflox + +## Configuration + +The PostgreSQL password is **not** stored in the code. `database.py` +reads it once from the environment variable `NETFLOX_DB_PASSWORD`: + +```bash +export NETFLOX_DB_PASSWORD='' +python main.py +``` + +If the variable is missing or empty the script stops immediately with +a `RuntimeError`; there is no default. Do not commit the value back +into the repository, and see the rotation note in the project issue +tracker if the old password was ever pushed. + +**Note:** `Projeto_Netflox_Alexandre_Almeida_Andre_Neto.zip` was removed from git +tracking because it contained a copy of `database.py` with the old password. +The archive still exists on disk but must not be committed again; regenerate it +without the password if it ever needs to be published.