security: pentest fixes — auth middleware, password policy, security headers#92
Merged
security: pentest fixes — auth middleware, password policy, security headers#92
Conversation
…headers
Findings from internal Kali pentest (2026-03-16) against v0.30.0-beta:
- F-03: Add /api/v1/auth/ exemption to API-key middleware (auth.py) so
UI login/setup/status endpoints are reachable when SUBLARR_API_KEY is
set. Without this, the web UI login flow was blocked by the API-key
middleware before the UI-auth handler could run.
- F-06: Raise minimum password length from 4 → 12 characters (auth_ui.py)
- F-07: Add X-Frame-Options: DENY, X-Content-Type-Options: nosniff and
Referrer-Policy: same-origin headers to all responses via after_request
hook (app.py)
- F-04: Gate version and service topology in /api/v1/health behind auth.
Unauthenticated callers (uptime monitors, scanners) now only receive
{"status": "healthy/unhealthy"} without version string or integration
details.
Full findings documented in PENTEST_FINDINGS.md (root of repo).
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Internal Kali Linux pentest (2026-03-16, VM201 → LXC 101) identified 11 findings. This PR fixes the 4 highest-priority code-level issues. Full findings documented in
PENTEST_FINDINGS.md.auth.py: Add/api/v1/auth/exemption to API-key middleware. Without this, UI login/setup/status were blocked by the API-key check whenSUBLARR_API_KEYwas set, making the web UI completely inaccessible.auth_ui.py: Raise minimum password length 4 → 12 characters.app.py: AddX-Frame-Options: DENY,X-Content-Type-Options: nosniff,Referrer-Policy: same-originviaafter_requesthook.routes/system.py: Gateversionandservicesin/api/v1/healthbehind auth. Unauthenticated callers receive only{"status": "healthy"}.Remaining open findings (follow-up)
flask-limiterdependencypct exec 101 -- systemctl disable rpcbind --now)Test plan
ruff check . && ruff format --check .— cleanpytest tests/test_auth.py tests/test_security.py— 35/35 passedSUBLARR_API_KEYis set (F-03 regression check)GET /api/v1/healthwithout auth returns only{"status": "healthy"}(no version)