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
View File
@@ -21,6 +21,10 @@ HERMEVEN_DB_PATH=./data/hermeven.sqlite
# Exact origins of the page that calls the bridge (comma separated, no wildcards).
# Read the real value from Diagnostics -> "Page origin" in the phone page.
# One wildcard is accepted: the port of a loopback address, written http://127.0.0.1:*
# The Even phone app serves an installed app from http://127.0.0.1:<port> and uses a new port
# on every launch, so an installed app needs exactly that entry. A page served from the
# bridge's own hostname (the QR sideload path) needs no entry at all.
HERMEVEN_ALLOWED_ORIGINS=
# --- Speech-to-text -----------------------------------------------------------