INNER CODE UNIT · Python

protect_outlook_mailbox_api

AaronL725/grok-register · web/server.py:162

async def protect_outlook_mailbox_api(request: Request, call_next):
    response = await call_next(request)
    if request.url.path.startswith("/api/mailboxes/outlook"):
        response.headers["Cache-Control"] = "no-store"
        response.headers["X-Content-Type-Options"] = "nosniff"
    return response


def _require_local_origin(request: Request) -> None:
    origin = str(request.headers.get("origin") or "").strip()
    if not origin:
        return
    from urllib.parse import urlsplit
    host = (urlsplit(origin).hostname or "").lower()
    if host not in {"127.0.0.1", "localhost", "::1"}:
        raise HTTPException(status_code=403, detail="Outlook 邮箱池只允许本地 WebUI 访问")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…