fix: allow Docker internal IPs for local operator + bump changelog text sizes

- require_local_operator now recognizes Docker bridge network IPs
  (172.x, 192.168.x, 10.x) as local, fixing "Forbidden — local operator
  access only" when frontend container calls wormhole/mesh endpoints
- Bumped all changelog modal text from 8-9px to 11-13px for readability
This commit is contained in:
anoracleofra-code
2026-03-26 10:23:31 -06:00
parent 8b52cbfe30
commit 4897a54803
2 changed files with 47 additions and 37 deletions
+12 -2
View File
@@ -1073,10 +1073,20 @@ def require_admin(request: Request):
raise HTTPException(status_code=403, detail=detail)
def _is_local_or_docker(host: str) -> bool:
"""Return True if the IP is loopback or a Docker-internal private network."""
if host in {"127.0.0.1", "::1", "localhost"}:
return True
# Docker bridge networks use 172.x.x.x or 192.168.x.x ranges
if host.startswith("172.") or host.startswith("192.168.") or host.startswith("10."):
return True
return False
def require_local_operator(request: Request):
"""Allow local tooling on loopback, or a valid admin key from elsewhere."""
"""Allow local tooling on loopback / Docker internal network, or a valid admin key."""
host = (request.client.host or "").lower() if request.client else ""
if host in {"127.0.0.1", "::1", "localhost"} or (_debug_mode_enabled() and host == "test"):
if _is_local_or_docker(host) or (_debug_mode_enabled() and host == "test"):
return
admin_key = _current_admin_key()
presented = str(request.headers.get("X-Admin-Key", "") or "").strip()