Only trust Authelia identity headers from TRUSTED_PROXIES
Security / JS Security (npm audit) (push) Failing after 17s
Lint / JS (eslint) (push) Successful in 18s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Lint / JS (eslint) (pull_request) Successful in 18s
Test / JS Tests (jest) (push) Successful in 20s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / JS Security (npm audit) (pull_request) Failing after 17s
Test / JS Tests (jest) (pull_request) Successful in 17s

authenticateSSO and authenticatePage took the user and groups straight
from the Remote-* headers, and the server listens on every interface, so
any LAN host could connect directly, claim any user and group, and run
commands on the workers. It could also write whatever it claimed into the
users table.

Add TRUSTED_PROXIES (addresses or CIDR ranges) and ignore the identity
headers unless the TCP peer is on the list. The peer address is used
rather than a forwarding header, which a client could forge. It fails
closed: unset means no SSO login succeeds, with a startup warning.
Rejected attempts are logged with their source. Worker and Gandalf
API-key routes are unchanged.

Closes #37

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-22 01:00:44 -05:00
1 parent dc47e335aa
commit e302234187
4 files changed
+256 -17

No files matched your search

+19 -1
View File
@@ -245,6 +245,9 @@ DB_PASSWORD=your-db-password
# Worker API Key (for worker authentication)
WORKER_API_KEY=your-worker-api-key
# Reverse proxy that runs Authelia forward auth (required for SSO logins)
TRUSTED_PROXIES=192.0.2.10
# Auto-cleanup configuration (optional)
EXECUTION_RETENTION_DAYS=30
EOF
@@ -393,7 +396,7 @@ The **Workers** tab displays real-time metrics for each worker:
- Load More button for large execution lists
### Security
- Authelia SSO integration for user authentication
- Authelia SSO integration for user authentication, with identity headers only accepted from `TRUSTED_PROXIES`
- API key authentication for workers
- User session management
- Admin-only operations (worker deletion, workflow management)
@@ -420,6 +423,7 @@ DB_NAME=pulse # Database name
DB_USER=pulse_user # Database user
DB_PASSWORD=<password> # Database password
WORKER_API_KEY=<api-key> # Worker authentication key
TRUSTED_PROXIES=<ip>[,<ip/cidr>] # Proxies allowed to send Authelia identity headers (required, see below)
EXECUTION_RETENTION_DAYS=30 # Auto-cleanup retention (default: 30)
# Web UI (all optional)
@@ -430,6 +434,20 @@ PULSE_DEV_READONLY=1 # Local dev guard: disable all background wr
DISABLE_BACKGROUND_JOBS=1 # Alias for PULSE_DEV_READONLY
```
### Trusted proxies
Authelia's forward auth passes the user to Pulse in the `Remote-User`, `Remote-Name`,
`Remote-Email` and `Remote-Groups` headers. Those headers are only trustworthy when the reverse
proxy sent the request, because the proxy overwrites them. Pulse listens on every interface, so
any other host that can reach the port could set them itself and log in as anyone.
`TRUSTED_PROXIES` is a comma-separated list of addresses or CIDR ranges (IPv4 or IPv6). Pulse
only accepts identity headers from a connection whose peer address is on the list. It uses the
TCP peer, not `X-Forwarded-For` or `X-Real-IP`, which a client could forge. Requests from
anywhere else are treated as not logged in, and are logged with their source address. It fails
closed: if `TRUSTED_PROXIES` is unset, no SSO login succeeds and a warning is printed at
startup. Invalid entries are logged and skipped. Worker and Gandalf API-key routes don't use it.
### Local development against a real database
Running a local instance against the production MariaDB is safe only with the read-only guard on: