Skip to content

🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Docker: fix Docker/docker-compose.yml indentation and SECRET_KEY variable (CFG-05)

Omega (QA)627bbd9229dc
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17d9692..5a400a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -43,6 +43,9 @@
- **Stored XSS fixes in the admin user list, document links, and the legacy edit modal (security):** three places rendered stored, user-controlled values into pages without safe encoding. The admin Users table in Settings now renders usernames as plain text, with the owner crown built as a DOM element, so a crafted username can no longer run script in an admin's browser when Settings loads. Warranty document links now pass the stored document URL through the same escaping and dangerous-scheme blocking the product link already used, so a quote stored in a document URL can no longer break out of the link's href attribute. The legacy edit modal shared by the main and status pages now fills serial number inputs through the input value property instead of interpolating serials into the markup, so a serial containing a quote can no longer break out of its attribute when a warranty is opened for editing under global view. Labels, icons, and layout are unchanged.
- _Files: `frontend/settings-new.js`, `frontend/js/components/warrantyRenderer.js`, `frontend/script.js`, `tests/test_xss_regressions.py`_
+- **Docker folder compose file fixed (install):** `Docker/docker-compose.yml` shipped with its DB_ADMIN_PASSWORD environment line dedented to the start of the line, which made the whole file invalid YAML that Docker Compose could not parse, and its SECRET_KEY line read a variable named APP_SECRET_KEY that neither shipped env example defines, so a SECRET_KEY set the documented way was silently ignored and the generated-key fallback used instead. The line is now indented with the rest of the environment block, and SECRET_KEY reads ${SECRET_KEY:-}, matching Docker/.env.example, env.example, and the root compose file. The rest of the file was checked for the same classes of defect and is clean.
+ - _Files: `Docker/docker-compose.yml`, `tests/test_compose_cfg05.py`_
+
# 1.0.4 - 2026-10-31
- **Claim documents (issue #148):** claims can now carry documents — claim approval or rejection letters, photos of the defect, repair invoices, and similar evidence. Each claim shows a Documents section in the claims view: attach a file directly, or upload it to Paperless-ngx and link it, then view or remove it from the same place. Access follows the warranty's other documents: the owner and admins only, never shared through global view. Deleting a claim or its warranty removes the attached local files from disk; Paperless documents are unlinked, never deleted from Paperless.
diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml
index c778831..7d2d5c6 100644
--- a/Docker/docker-compose.yml
+++ b/Docker/docker-compose.yml
@@ -12,12 +12,12 @@ services:
- DB_USER=warranty_user
- DB_PASSWORD=${DB_PASSWORD:-warranty_password}
- DB_ADMIN_USER=warracker_admin
-- DB_ADMIN_PASSWORD=${DB_ADMIN_PASSWORD:-change_this_password_in_production}
+ - DB_ADMIN_PASSWORD=${DB_ADMIN_PASSWORD:-change_this_password_in_production}
- SMTP_HOST=smtp.email.com
- SMTP_PORT=465
- SMTP_PASSWORD=password
- - SECRET_KEY=${APP_SECRET_KEY:-} # Leave unset to auto-generate and persist a random key (backend config); do NOT give this a known default
+ - SECRET_KEY=${SECRET_KEY:-} # Leave unset to auto-generate and persist a random key (backend config); do NOT give this a known default
- MAX_UPLOAD_MB=32 # Example: Set max upload size to 32MB
- NGINX_MAX_BODY_SIZE_VALUE=32M # For Nginx, ensure this matches MAX_UPLOAD_MB in concept (e.g., 32M)
# OIDC SSO Configuration (User needs to set these based on their OIDC provider)
diff --git a/tests/test_compose_cfg05.py b/tests/test_compose_cfg05.py
new file mode 100644
index 0000000..4b73f68
--- /dev/null
+++ b/tests/test_compose_cfg05.py
@@ -0,0 +1,31 @@
+"""Regression pin for CFG-05: Docker/docker-compose.yml shipped one
+environment line (DB_ADMIN_PASSWORD) dedented to column 0, which makes
+the file invalid YAML for any conformant parser, and read SECRET_KEY
+from ${APP_SECRET_KEY:-} — a variable name no shipped env example
+defines (both examples and the root compose file use SECRET_KEY), so
+installs silently fell back to the generated, non-persisting key path.
+
+Kept dependency-free (no yaml import: PyYAML is not a project
+dependency); the full YAML parse is verified separately in the QA
+environment.
+"""
+import os
+import re
+
+REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+def test_docker_compose_env_indentation_and_secret_var():
+ with open(os.path.join(REPO_ROOT, "Docker/docker-compose.yml"),
+ encoding="utf-8") as fh:
+ lines = fh.read().splitlines()
+ env_lines = [
+ line for line in lines if re.match(r"^\s*- [A-Z_]+=", line)
+ ]
+ assert env_lines, "no environment entries found"
+ indents = {len(line) - len(line.lstrip(" ")) for line in env_lines}
+ assert indents == {6}, (
+ f"environment entries must share one indent: {indents}")
+ src = "\n".join(lines)
+ assert "SECRET_KEY=${SECRET_KEY:-}" in src
+ assert "APP_SECRET_KEY" not in src