Skip to content

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

Changelog: record the security audit Medium and Medium-Low fixes

Omega (QA)bda17443d3b0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3241d1b..5d986d7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -52,6 +52,28 @@
- _Files: `frontend/js/components/formTabs.js`, `frontend/js/components/addWarrantyForm.js`, `tests/test_xss_regressions.py`_
- **Offline caching fixed on plain static hosting:** the service worker precached two files that do not exist, and because the install cached everything atomically, one missing file rolled back the whole batch and left offline caching silently empty. The dead entries are gone, and the install now caches each file on its own, logging a warning for any file that fails instead of voiding the rest.
- _Files: `frontend/sw.js`, `tests/test_service_worker.py`_
+- **Security hardening, OIDC-only mode enforced:** the `oidc_only_mode` setting was read by the login screen but ignored by the backend, so with only-mode on, a local login to an OIDC-only account failed with a server error, a password reset minted it a local password from nothing, and local registration stayed open. The backend now refuses local sign-in and local registration while only-mode is on, mints no reset token for an OIDC-managed account, and refuses reset completion for one. Local accounts can still request a reset under only-mode, for use if the mode is later turned off. Installs that rely on local sign-in while only-mode is on lose local access until an OIDC admin turns the mode off or the `OIDC_ONLY_MODE` variable is set to false.
+ - _Files: `backend/auth_routes.py`, `tests/test_oidc_only_mode.py`_
+- **Security hardening, email changes:** changing the account email in settings needed only a session token, so a stolen session could move the account to an attacker address and then take it over with a password reset to the new address. An email change now requires the current password, and a notice goes to the old address. Accounts with no local password (single sign-on) cannot change their email here; an administrator changes it instead. The separate change-email route already required the password and now sends the old-address notice too.
+ - _Files: `backend/auth_routes.py`, `frontend/settings-new.html`, `frontend/settings-new.js`, `tests/test_profile_email_change.py`_
+- **Security hardening, token revocation:** an issued token stayed valid after logout, password change, and password reset, because the session table was written but never read for authentication and tokens carried no id. Tokens now carry a per-login id stored as the session row, and authentication refuses a token whose session row is gone. Logout deletes all sessions for the user, password change deletes all sessions except the current one, and password reset completion deletes them all. Tokens minted before this upgrade carry no id and stay valid until their 24 hour expiry.
+ - _Files: `backend/auth_utils.py`, `backend/auth_routes.py`, `backend/oidc_handler.py`, `tests/test_token_revocation.py`_
+- **Security hardening, auth rate limiting:** the auth surface had no rate limiting: rapid failed logins drew no response, and repeated reset requests minted a token per request. Login now allows 10 failures per address and username pair in 5 minutes, then answers 429, and a successful login clears the count. Password reset requests are capped at 5 per email address per hour, with a capped request answering exactly like an unknown address and minting no token. The limiter is in memory per worker, so an install running two workers allows twice the budget to a distributed attacker. Registration is not limited.
+ - _Files: `backend/rate_limit.py`, `backend/auth_routes.py`, `tests/test_rate_limiting.py`_
+- **Security hardening, CSV import integrity and cost:** one bad row used to abort the whole import transaction, so the commit at the end rolled everything back while the API still reported the rows imported before the failure. Each row now runs under its own savepoint, so a failed row is confined to itself and the reported counts are accurate. Duplicate renaming also restarted its suffix search at 1 for every row, so a same-name import re-checked every earlier suffix per row and a 5,000 row import ran for over 12 minutes; the search now resumes where the last row left off, and the same 5,000 row shape finishes in seconds with identical renaming.
+ - _Files: `backend/warranties_routes.py`, `tests/test_csv_import_integrity.py`_
+- **Security hardening, Paperless search and cleanup:** the Paperless search response passed the upstream `all` array (the ids of every matching document instance-wide) and the `previous` URL (carrying the internal Paperless host) through to non-admin users, even when their own filtered result set was empty. Both are now stripped for non-admins. Cleanup of invalid Paperless references also treated any Paperless error as "document gone", so an outage unlinked live references. The handler now distinguishes exists, gone, and unknown, and cleanup only unlinks on gone; unreachable documents are left in place and reported as skipped.
+ - _Files: `backend/file_routes.py`, `backend/paperless_handler.py`, `tests/test_paperless_mediums.py`_
+- **Security hardening, Paperless documents without URL tokens:** opening a Paperless document put the full token in the URL, where it persisted in browser history and in the service worker cache. Both document-open flows now fetch with the token in the Authorization header and open a blob URL instead. The API still accepts a token in the query string for direct links pasted into a browser.
+ - _Files: `frontend/script.js`, `frontend/js/components/paperless.js`, `tests/test_auth02_no_token_urls.py`_
+- **Security hardening, OIDC login without URL tokens:** the SSO callback delivered the full 24 hour token in the redirect URL, where it persisted in browser history. The callback now stores a short-lived single-use code (60 seconds, only its hash stored) and redirects with it, and the frontend exchanges the code for the token over POST. Each code is deleted on first use, and the service worker cache name was bumped so browsers fetch the new redirect page. A user with a stale cached redirect page sees one failed sign-in attempt after the upgrade, then it works.
+ - _Files: `backend/oidc_handler.py`, `backend/auth_routes.py`, `backend/migrations/055_create_oidc_login_codes.sql`, `frontend/auth-redirect.html`, `frontend/sw.js`, `tests/test_oidc_code_exchange.py`_
+- **Security hardening, first-user race:** ten concurrent first registrations all succeeded and left two owners, because each checked the user count before any of them had committed. Registration and OIDC provisioning now take a database advisory lock before the user-count check, so exactly one becomes owner and admin. The lock is held only for the count and insert, never during password hashing, and releases at commit or rollback.
+ - _Files: `backend/auth_utils.py`, `backend/auth_routes.py`, `backend/oidc_handler.py`, `tests/test_a_first_user_race.py`_
+- **Security hardening, CSV export formulas:** exported CSV carried formula-leading values with quoting only, so a spreadsheet app evaluated them on import. Values whose first non-space character is =, +, -, @, tab, or carriage return now get a tab prefix, which keeps them inert in the spreadsheet and is stripped by the importer, so a re-imported export round-trips to the stored value.
+ - _Files: `frontend/js/components/importExport.js`, `frontend/status.js`, `tests/test_csv_formula_neutralization.py`_
+- **Security hardening, CSV and claim dates:** the importer and the claim endpoints accepted anything the date parser would read, so "03/04/2024" silently became March 4 (month-first). Only ISO YYYY-MM-DD and named-month dates are accepted now (15 Mar 2024, 15 March 2024, Mar 15, 2024, March 15, 2024, and the comma-less variants). Anything else, including ambiguous numeric dates, is rejected with an error naming the accepted formats. Imports that relied on flexible numeric dates need their dates rewritten.
+ - _Files: `backend/warranties_routes.py`, `tests/test_csv_date_formats.py`_
## 1.0.6 - 2026-11-10