```
feat: 添加飞书用户模块和订阅功能支持 - 新增feishu_users模块用于处理飞书用户身份验证和权限管理 - 新增subscriptions模块用于处理订阅相关功能 - 新增personalization模块用于个性化服务 - 在alembic迁移配置中注册新的模型模块 - 在API路由器中添加feishu_users和subscriptions路由 - 实现事件调度服务的改进,包括错误处理和状态更新优化 - 添加飞书命令处理的权限检查机制 - 实现飞书应用票据事件处理 - 改进审计日志记录功能 ```
This commit is contained in:
@@ -4,9 +4,10 @@ from typing import Any
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.http.masking import is_sensitive_key
|
||||
from app.core.http.pagination import bounded_limit
|
||||
from app.core.http.request_context import get_request_id
|
||||
from app.modules.audit.constants import AUDIT_REDACTED_VALUE, AUDIT_SENSITIVE_KEYS
|
||||
from app.modules.audit.constants import AUDIT_REDACTED_VALUE
|
||||
from app.modules.audit.models import AuditLog
|
||||
from app.modules.audit.schemas import AuditLogCreate
|
||||
|
||||
@@ -16,7 +17,7 @@ def _redact(value: Any) -> Any:
|
||||
safe: dict[str, Any] = {}
|
||||
for key, item in value.items():
|
||||
key_text = str(key)
|
||||
if key_text.lower() in AUDIT_SENSITIVE_KEYS:
|
||||
if is_sensitive_key(key_text):
|
||||
safe[key_text] = AUDIT_REDACTED_VALUE
|
||||
else:
|
||||
safe[key_text] = _redact(item)
|
||||
@@ -34,6 +35,12 @@ def _dump(value: Any | None) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
parsed = json.loads(value)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
return value
|
||||
if isinstance(parsed, (dict, list)):
|
||||
return json.dumps(_redact(parsed), ensure_ascii=False, default=str)
|
||||
return value
|
||||
return json.dumps(_redact(value), ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user