Allow loopback origins on any port when configured (http://127.0.0.1:*)

An app installed through Even Hub is served by the Even phone app from
http://127.0.0.1:<port>, and the port changed between two launches on a
real phone (40315, then another). An exact-origin allow-list therefore
cannot admit it. HERMEVEN_ALLOWED_ORIGINS now accepts one wildcard form,
the port of a loopback address over http (127.0.0.1, localhost, [::1]),
off unless configured. No other wildcard is accepted. CORS remains
advisory: every route still requires the device credential.

Tests: 224 unit/integration. Not reviewed, not deployed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Dan
2026-11-21 13:31:40 -08:00
co-authored by Claude Fable 5.2
parent fd992559af
commit bc00ae9fb1
6 changed files with 140 additions and 7 deletions
+4 -2
View File
@@ -8,8 +8,10 @@ HERMEVEN_PORT=8787
# Caddy is in front, so the client address comes from its forwarded header.
HERMEVEN_TRUST_PROXY=true
HERMEVEN_DB_PATH=/var/lib/hermeven/hermeven.sqlite
# Read the real value from the phone page: Diagnostics -> "Page origin".
HERMEVEN_ALLOWED_ORIGINS=
# An app installed through Even Hub is served from http://127.0.0.1:<port>, with a new port on
# every launch, so it needs the loopback any-port entry below. Remove it if you only ever load
# the page from this bridge's own hostname (QR sideload), which needs no entry.
HERMEVEN_ALLOWED_ORIGINS=http://127.0.0.1:*
# Built-in speech-to-text (the default). The model is pinned and verified; the running service
# never downloads it and only reads this directory. Populate it at deploy time with