security: P2 生产深度加固 — 路径/鉴权/脱敏/校验/持久化/过期

4.3 文件管理器路径收紧:
- 默认移除 Path('/') 全文件系统访问
- 仅允许项目目录 + data/ + 环境变量 SENSU_FILE_ROOTS 指定路径

3.4 插件路由鉴权修复:
- _check_plugin_auth 增加 panel_token 用户身份验证
- 先验证用户登录, 再检查插件权限

4.2 错误脱敏:
- security middleware 捕获异常 → 通用 'Internal server error'
- 堆栈详情仅写入日志, 不暴露给客户端

4.4 命令参数校验:
- POST /api/command 拒绝 shell 元字符 (;&|`$(){}!#~<>)
- 防止命令注入

4.5 Session 持久化:
- 登录/退出时保存到 SenSuDB.config_kv
- 框架重启后自动恢复已持久化会话

4.6 Token 过期: 24h → 2h

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
qinglong
2026-06-13 13:50:51 +08:00
parent 2f9063d6d4
commit fcac02d920
7 changed files with 108 additions and 38 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ commands:
permissions:
- framework.command.test
source: internal
last_updated: 11552.003166269
last_updated: 11814.024966534
plugin_commands:
example_plugin:
echo: *id001