feat: 添加飞书用户模块和订阅功能支持

- 新增feishu_users模块用于处理飞书用户身份验证和权限管理
- 新增subscriptions模块用于处理订阅相关功能
- 新增personalization模块用于个性化服务
- 在alembic迁移配置中注册新的模型模块
- 在API路由器中添加feishu_users和subscriptions路由
- 实现事件调度服务的改进,包括错误处理和状态更新优化
- 添加飞书命令处理的权限检查机制
- 实现飞书应用票据事件处理
- 改进审计日志记录功能
```
This commit is contained in:
2026-07-27 08:02:17 +08:00
parent db751f03b4
commit d7db84571d
148 changed files with 17110 additions and 765 deletions

View File

@@ -6,26 +6,61 @@ from app.core.config import get_settings
MASKED_VALUE = "[MASKED]"
SENSITIVE_RESPONSE_KEYS = frozenset(
{
"access_token",
"account_number",
"api_key",
"apikey",
"app_access_token",
"app_ticket",
"audit_api_key",
"authorization",
"bank_account",
"card_no",
"client_secret",
"cookie",
"direct_llm_api_key",
"email",
"encrypt_key",
"feishu_app_secret",
"feishu_app_ticket",
"feishu_encrypt_key",
"feishu_verification_token",
"hermes_api_key",
"id_card",
"market_data_token",
"mobile",
"openclaw_api_key",
"openclaw_gateway_token",
"password",
"payment_account",
"phone",
"private_key",
"refresh_token",
"secret",
"secret_key",
"set-cookie",
"set_cookie",
"tenant_access_token",
"token",
"x-api-key",
"x-audit-api-key",
"x_api_key",
"x_audit_api_key",
}
)
NORMALIZED_SENSITIVE_RESPONSE_KEYS = frozenset(
"".join(character for character in key.casefold() if character.isalnum())
for key in SENSITIVE_RESPONSE_KEYS
)
def is_sensitive_key(key: str) -> bool:
"""Return whether a key matches a built-in sensitive field name."""
normalized = "".join(
character for character in key.casefold() if character.isalnum()
)
return normalized in NORMALIZED_SENSITIVE_RESPONSE_KEYS
def mask_configured(value: Any, domain: str | None = None) -> Any:
@@ -61,7 +96,7 @@ def mask_sensitive(
def _should_mask(key: str, domain: str | None, configured_fields: set[str]) -> bool:
field = key.lower()
if field in SENSITIVE_RESPONSE_KEYS or field in configured_fields:
if is_sensitive_key(key) or field in configured_fields:
return True
if f"*.{field}" in configured_fields:
return True