fix(iwooos): 脫敏 tenants public identity
All checks were successful
Code Review / ai-code-review (push) Successful in 15s
CD Pipeline / tests (push) Successful in 1m29s
CD Pipeline / build-and-deploy (push) Successful in 4m14s
CD Pipeline / post-deploy-checks (push) Successful in 1m44s

This commit is contained in:
Your Name
2026-06-14 23:18:54 +08:00
parent 92e451cbdd
commit 8a6be1a1c1
20 changed files with 2509 additions and 95 deletions

View File

@@ -7,6 +7,16 @@ from src.api.v1.platform.tenants import ListTenantsResponse
from src.services.platform_operator_service import build_tenant_asset_inventory
FORBIDDEN_PUBLIC_MARKERS = [
"Vibe" + "Work",
"Agent " + "Bounty " + "Protocol",
"agent-" + "bounty-" + "protocol",
"AWOOOI / " + "AwoooP / " + "IwoooS",
"Tsen" + "Yang Website",
"Bitan " + "Pharmacy",
]
def test_tenant_asset_inventory_merges_products_routes_and_repos() -> None:
tenants = [
{
@@ -35,20 +45,22 @@ def test_tenant_asset_inventory_merges_products_routes_and_repos() -> None:
product_ids = {item["product_id"] for item in inventory["products"]}
assert {
"awoooi",
"ewoooc",
"vibework",
"agent-bounty-protocol",
"2026-fifa-world-cup",
"stockplatform",
"bitan-pharmacy",
"tsenyang-website",
"wooo-open-design",
"workflow-automation",
"data-workspace",
"security-secrets-platform",
"ai-model-gateway",
"PRD-001",
"PRD-002",
"PRD-003",
"PRD-004",
"PRD-005",
"PRD-006",
"PRD-007",
"PRD-008",
"PRD-010",
"PRD-011",
"PRD-012",
"PRD-013",
"PRD-014",
}.issubset(product_ids)
assert all(re.fullmatch(r"PRD-\d{3}", item["project_id"]) for item in inventory["products"])
assert all(item["source_keys"] == [] or all(key.startswith("SRCREF-") for key in item["source_keys"]) for item in inventory["products"])
route_domains = {item["domain"] for item in inventory["public_routes"]}
assert {
@@ -78,6 +90,7 @@ def test_tenant_asset_inventory_merges_products_routes_and_repos() -> None:
inventory_payload = json.dumps(inventory, ensure_ascii=False)
assert "owenhytsai" not in inventory_payload
assert "nexu-io" not in inventory_payload
assert all(marker not in inventory_payload for marker in FORBIDDEN_PUBLIC_MARKERS)
assert all(item["runtime_gate_count"] == 0 for item in inventory["source_repos"])
assert all(item["action_button_count"] == 0 for item in inventory["public_routes"])
assert all(item["runtime_gate_count"] == 0 for item in inventory["products"])
@@ -108,4 +121,5 @@ def test_tenant_response_model_keeps_asset_inventory_contract() -> None:
response_payload = response.model_dump_json()
assert "owenhytsai" not in response_payload
assert "nexu-io" not in response_payload
assert all(marker not in response_payload for marker in FORBIDDEN_PUBLIC_MARKERS[:3])
assert response.asset_inventory.source_repos[0].source_namespace_redacted is True