mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +02:00
fix(authz):add zero context authorization checks
This commit is contained in:
parent
08c1d12eb1
commit
7241a7a894
3 changed files with 136 additions and 0 deletions
22
surfsense_backend/tests/unit/test_zero_authz_static.py
Normal file
22
surfsense_backend/tests/unit/test_zero_authz_static.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""Static guards for Zero authorization wiring."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[3]
|
||||
WEB_ROOT = REPO_ROOT / "surfsense_web"
|
||||
|
||||
|
||||
def test_zero_query_route_uses_authoritative_backend_context() -> None:
|
||||
route = WEB_ROOT / "app/api/zero/query/route.ts"
|
||||
text = route.read_text()
|
||||
|
||||
assert "/zero/context" in text
|
||||
assert "/users/me" not in text
|
||||
assert "userID: auth.ctx.userId" in text
|
||||
assert "handleQueryRequest({" in text
|
||||
Loading…
Add table
Add a link
Reference in a new issue