fix(security): 16 mittlere Probleme behoben (P18-P33)
Check Cross-Plugin Imports / check (push) Has been cancelled

P18: require_permission zu forgejo_error_reporter und ai_ui_control routes hinzugefügt
P19: Cross-Tenant Permission-Cache-Invalidierung bei Rollenänderungen
P20: Session/Permission-Cache-Invalidierung bei Gruppen-Änderungen
P21: ENTITY_MODELS Registry um fehlende Plugin-Modelle erweitert
P22: Entity-Links prüfen verknüpfte Entity-Permissions
P23: authStore persist Middleware entfernt (kein localStorage mehr)
P24: 5xx Retry nur noch für GET-Requests
P25: KI-Kommentar in address.py (bekannte Inkonsistenz)
P26: DeletionLog in EntityHistory gemerged (action=delete)
P27: KI-Kommentar in entity_policy.py (ABAC nicht aktiv genutzt)
P28: db.commit() aus bulk_permission_service entfernt
P29: CSV-Export in export_service.py ausgelagert
P30: plugins.py Business-Logik in plugin_install_service.py ausgelagert
P31: KI-Kommentar in session.py (Dual-System dokumentiert)
P32: Migration 0115: crm_platform_admin Role droppen
P33: Cross-Plugin Imports über contracts.py behoben (10 Violations → 0)
This commit is contained in:
Agent Zero
2026-08-06 13:23:58 +02:00
parent 9f79107fa7
commit 0eb6d7621e
32 changed files with 593 additions and 307 deletions
+18
View File
@@ -9,6 +9,7 @@ from sqlalchemy import delete, func, select
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import selectinload
from app.core.auth import get_redis
from app.core.permissions import invalidate_all_user_permissions
from app.models.group import Group, UserGroup
from app.models.user import User, UserTenant
@@ -107,6 +108,12 @@ class GroupService:
group.permission_version += 1
await db.flush()
# Invalidate permission cache for all group members when permissions change
if version_bump:
redis = get_redis()
await invalidate_all_user_permissions(redis, tenant_id)
return group
async def delete_group(
@@ -192,6 +199,11 @@ class GroupService:
)
db.add(ug)
await db.flush()
# Invalidate permission cache for the added user
redis = get_redis()
await invalidate_all_user_permissions(redis, tenant_id)
return True
async def remove_user_from_group(
@@ -209,6 +221,12 @@ class GroupService:
)
result = await db.execute(q)
await db.flush()
# Invalidate permission cache for the removed user
if result.rowcount > 0:
redis = get_redis()
await invalidate_all_user_permissions(redis, tenant_id)
return result.rowcount > 0
async def get_user_groups(