Implement TEN-WP-0011 security layer conformance
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 37s
All checks were successful
Build and Publish Container Image / build-and-push (push) Successful in 37s
Engine/PIP declaration is now checkable (layer.yaml plus a Tooling-client scan). Writes persist a decision record or the published fail-closed stance, live-lookup freshness is published, events_for is tenant-scoped, and mutation evidence drains to audit-core from a local outbox without blocking the mutation. Sender registration is requested as AUDIT-IN-0002. Boundary-contract amendment is requested as NET-IN-0002. Assistant: grok Assistant-Session: 01a04cea-e5e8-7081-a0fc-808ebbc35fa9
This commit is contained in:
parent
80961af91e
commit
672cf4da6e
40 changed files with 2285 additions and 361 deletions
|
|
@ -1,18 +1,13 @@
|
|||
from fastapi.testclient import TestClient
|
||||
from helpers import AllowAllAuthorizer
|
||||
|
||||
from tenant_engine.app import create_app
|
||||
from tenant_engine.authz import WriteAuthorizer
|
||||
from tenant_engine.store import InMemoryTenantStore
|
||||
|
||||
|
||||
class _AllowAllAuthorizer(WriteAuthorizer):
|
||||
def authorize(self, *, action: str, tenant_id: str, actor: str) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def _client(*, allow: bool = False) -> TestClient:
|
||||
store = InMemoryTenantStore()
|
||||
authorizer = _AllowAllAuthorizer() if allow else None
|
||||
authorizer = AllowAllAuthorizer() if allow else None
|
||||
return TestClient(create_app(store=store, authorizer=authorizer))
|
||||
|
||||
|
||||
|
|
@ -99,7 +94,9 @@ def test_create_tenant_rejects_invalid_identifier_after_authorization() -> None:
|
|||
|
||||
def test_create_tenant_duplicate_is_409() -> None:
|
||||
client = _client(allow=True)
|
||||
client.post("/tenants", json={"tenant_id": "t-1", "identifier": "tenant:friendly:binky", "actor": "ops"})
|
||||
client.post(
|
||||
"/tenants", json={"tenant_id": "t-1", "identifier": "tenant:friendly:binky", "actor": "ops"}
|
||||
)
|
||||
response = client.post(
|
||||
"/tenants", json={"tenant_id": "t-1", "identifier": "tenant:friendly:binky", "actor": "ops"}
|
||||
)
|
||||
|
|
@ -108,7 +105,9 @@ def test_create_tenant_duplicate_is_409() -> None:
|
|||
|
||||
def test_grant_role_plan_assignment_without_plan_id_is_400() -> None:
|
||||
client = _client(allow=True)
|
||||
client.post("/tenants", json={"tenant_id": "t-1", "identifier": "tenant:friendly:binky", "actor": "ops"})
|
||||
client.post(
|
||||
"/tenants", json={"tenant_id": "t-1", "identifier": "tenant:friendly:binky", "actor": "ops"}
|
||||
)
|
||||
|
||||
response = client.post(
|
||||
"/tenants/t-1/roles/grant",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue