40 lines
1.5 KiB
Markdown
40 lines
1.5 KiB
Markdown
|
|
# Changelog — 文件管理提权检测与 elevation 策略
|
|||
|
|
|
|||
|
|
| 项 | 内容 |
|
|||
|
|
|----|------|
|
|||
|
|
| 日期 | 2026-06-01 |
|
|||
|
|
| 类型 | 功能(Phase 4) |
|
|||
|
|
|
|||
|
|
## 摘要
|
|||
|
|
|
|||
|
|
新增 `GET /api/servers/{id}/files-capability` 探测目标机免密 sudo 与 chmod/chown 白名单;服务器级 `files_elevation`(`off` / `auto_sudo` / `always_sudo`)存入 `extra_attrs` 并驱动 `remote_shell` 提权行为;前端权限对话框与服务器编辑表单对接。
|
|||
|
|
|
|||
|
|
## 动机
|
|||
|
|
|
|||
|
|
完成文件管理设计文档 Phase 4:运维可在改权限前检测提权能力,并按服务器关闭/自动/始终 sudo。
|
|||
|
|
|
|||
|
|
## 涉及文件
|
|||
|
|
|
|||
|
|
- `server/utils/files_elevation.py`(新建)
|
|||
|
|
- `server/infrastructure/ssh/files_capability.py`(新建)
|
|||
|
|
- `server/infrastructure/ssh/remote_shell.py`
|
|||
|
|
- `server/api/servers.py`、`server/api/schemas.py`
|
|||
|
|
- `frontend/src/components/FilePermissionDialog.vue`
|
|||
|
|
- `frontend/src/pages/FilesPage.vue`、`ServersPage.vue`
|
|||
|
|
- `frontend/src/types/api.ts`
|
|||
|
|
- `tests/test_files_elevation.py`(新建)
|
|||
|
|
|
|||
|
|
## 迁移 / 重启
|
|||
|
|
|
|||
|
|
- 无 DB 迁移;默认 `auto_sudo`(未配置 `extra_attrs` 时等同历史行为)。
|
|||
|
|
- 需重启 Nexus 后端;前端需重新 `vite build` 部署。
|
|||
|
|
|
|||
|
|
## 验证
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
pytest tests/test_files_elevation.py tests/test_unix_ls.py -q
|
|||
|
|
ruff check server/utils/files_elevation.py server/infrastructure/ssh/files_capability.py server/infrastructure/ssh/remote_shell.py
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
浏览器:服务器编辑 → 文件管理提权;`#/files` → 右键修改权限 →「检测提权能力」。
|