feat(maf): add secure roundtable workflow runtime
This commit is contained in:
1 parent
e690475e6e
commit
bd4131b4e2
52 files changed
+10315
-96
No files matched your search
@@ -1,14 +1,14 @@
|
||||
"""P1 admin write-boundary + P2 config-default tests for the MAF roundtable.
|
||||
|
||||
P1 — admin diagnostic access is **read-only**:
|
||||
P1 —admin diagnostic access is **read-only**:
|
||||
- An admin with ``admin_diagnostic_access=True`` can *read* another user's
|
||||
session / run / action / approval (cross-user diagnostics).
|
||||
- The same admin **cannot** *write* another user's resources: update / delete
|
||||
session, start / cancel run, append event, decide approval all raise
|
||||
``MafForbiddenError`` (→ HTTP 403), never silently succeeding.
|
||||
``MafForbiddenError`` (→HTTP 403), never silently succeeding.
|
||||
- Normal users remain fully isolated from each other.
|
||||
|
||||
P2 — config-driven create defaults:
|
||||
P2 —config-driven create defaults:
|
||||
- Omitted ``mode`` / ``write_policy`` / ``max_rounds`` fall back to the deployed
|
||||
``MafRoundtableConfig`` values.
|
||||
- An explicit request value overrides the config default.
|
||||
@@ -18,13 +18,10 @@ from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from maf_test_helpers import make_maf_service
|
||||
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||
|
||||
from app.maf_roundtable.service import (
|
||||
MafForbiddenError,
|
||||
MafNotFoundError,
|
||||
MafRoundtableService,
|
||||
)
|
||||
from app.maf_roundtable.service import MafForbiddenError, MafNotFoundError
|
||||
from deerflow.config.maf_roundtable_config import MafRoundtableConfig
|
||||
from deerflow.persistence.base import Base
|
||||
from deerflow.persistence.maf_roundtable import make_maf_roundtable_store
|
||||
@@ -43,7 +40,7 @@ async def store(tmp_path):
|
||||
|
||||
|
||||
def _svc(store, *, enabled=True, admin_diagnostic_access=True, config=None):
|
||||
return MafRoundtableService(
|
||||
return make_maf_service(
|
||||
store,
|
||||
enabled=enabled,
|
||||
admin_diagnostic_access=admin_diagnostic_access,
|
||||
@@ -165,7 +162,7 @@ async def test_admin_diagnostic_off_cannot_even_read_cross_user(store):
|
||||
async def test_normal_users_remain_fully_isolated(store):
|
||||
svc = _svc(store, admin_diagnostic_access=True)
|
||||
s = await svc.create_session(user_id="alice", body={"task_text": "t"})
|
||||
# bob is a non-admin → isolated on both read and write.
|
||||
# bob is a non-admin →isolated on both read and write.
|
||||
with pytest.raises(MafNotFoundError):
|
||||
await svc.get_session(session_id=s["id"], user_id="bob")
|
||||
with pytest.raises(MafNotFoundError):
|
||||
|
||||
Reference in new issue
Block a user