Make TRUSTED_PROXIES' insecure-by-default risk loudly visible (#94)
TRUSTED_PROXIES ships empty in .env.example, which disables AuthMiddleware's reverse-proxy allowlist entirely — a fresh deployment that doesn't explicitly set it has zero verification that Remote-User/Remote-Groups headers actually came from the trusted Authelia proxy. Anything that can reach the app directly (a misconfigured firewall rule, an exposed container port, SSRF from another internal service) can set Remote-User: admin and fully impersonate any user with zero authentication. The enforcement logic itself was already correct; this was purely a dangerous, easy-to-miss default. Added a boxed, unmissable warning around TRUSTED_PROXIES in .env.example (previously just an inline comment easy to skim past), added the same warning to README's setup instructions (which didn't mention this variable at all), and added a Check 8 to api/health.php that reports a 'warning' status when TRUSTED_PROXIES is empty, so a deployment that forgets it doesn't go unnoticed after the fact. Verified against real MariaDB via a running server: the health endpoint correctly reports 'warning' when empty and 'ok' once set. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lhz7pGMaoTfL5sdYS5XiKv
This commit is contained in:
@@ -447,6 +447,21 @@ APP_DOMAIN=your.domain.example
|
||||
TIMEZONE=America/New_York
|
||||
```
|
||||
|
||||
**⚠️ REQUIRED FOR PRODUCTION — `TRUSTED_PROXIES`:** This app trusts Authelia
|
||||
forward-auth headers (`Remote-User`, `Remote-Groups`, etc.) to identify who's
|
||||
logged in. `TRUSTED_PROXIES` restricts that trust to requests that actually
|
||||
came through your reverse proxy — **leaving it empty disables that check
|
||||
entirely**, and anyone who can reach the PHP backend directly (a
|
||||
misconfigured firewall rule, an exposed container port, SSRF from another
|
||||
internal service) can set `Remote-User: admin` themselves and fully
|
||||
impersonate any user with zero authentication. Set it to your reverse proxy's
|
||||
IP address(es) before deploying anywhere reachable beyond your own machine:
|
||||
```env
|
||||
TRUSTED_PROXIES=10.10.10.27
|
||||
```
|
||||
`GET /api/health.php` reports a `warning` on the `trusted_proxies` check if
|
||||
this is left empty, so it doesn't go unnoticed after deployment.
|
||||
|
||||
Matrix notification variables (all optional):
|
||||
```env
|
||||
# hookshot generic webhook URL — send events to Matrix room
|
||||
|
||||
Reference in New Issue
Block a user