mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-28 16:52:22 +01:00
feat(auth): define Default/Local owner contract (#5795)
* feat(auth): define default local owner contract * test(auth): harden default local owner matrix --------- Co-authored-by: Alexandre Teixeira <111787685+alteixeira20@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexandre Teixeira
parent
9c71948376
commit
0dd70a7556
@@ -131,6 +131,12 @@ def test_readme_native_quickstart_uses_loopback():
|
||||
assert "0.0.0.0` only when you intentionally want" in docs
|
||||
|
||||
|
||||
def test_readme_warns_auth_enabled_for_network_access():
|
||||
readme = Path("README.md").read_text(encoding="utf-8")
|
||||
assert "Keep `AUTH_ENABLED=true` for any network-accessible deployment." in readme
|
||||
assert "Keep `LOCALHOST_BYPASS=false` outside local development." in readme
|
||||
|
||||
|
||||
def test_ollama_cookbook_runner_does_not_force_public_bind():
|
||||
route = Path("routes/cookbook_routes.py").read_text(encoding="utf-8")
|
||||
cookbook_js = Path("static/js/cookbook.js").read_text(encoding="utf-8")
|
||||
@@ -738,6 +744,27 @@ def test_require_admin_allows_when_auth_explicitly_disabled(monkeypatch):
|
||||
assert require_admin(_Req()) is None
|
||||
|
||||
|
||||
def test_require_admin_uses_central_auth_disabled_parser(monkeypatch):
|
||||
from core.middleware import require_admin
|
||||
|
||||
monkeypatch.setenv("AUTH_ENABLED", " false ")
|
||||
|
||||
class _State:
|
||||
current_user = None
|
||||
|
||||
class _AppState:
|
||||
auth_manager = None
|
||||
|
||||
class _App:
|
||||
state = _AppState()
|
||||
|
||||
class _Req:
|
||||
state = _State()
|
||||
app = _App()
|
||||
|
||||
assert require_admin(_Req()) is None
|
||||
|
||||
|
||||
def test_internal_tool_owner_header_logic_requires_known_user():
|
||||
"""Pin the owner-attribution branch used by app.AuthMiddleware without
|
||||
booting the full FastAPI app."""
|
||||
|
||||
Reference in New Issue
Block a user