feat: 为本地 HTTP API 增加 Token 鉴权与安全加固

- 使用 Electron safeStorage 加密存储并自动初始化 API Token
- 为 health 以外的接口增加 Bearer Token 鉴权
- 限制 CORS 仅允许可信本地 Origin
- 增加鉴权、Token rotation、safeStorage 和手动验收测试
This commit is contained in:
Wxw-Gu committed 2026-08-07 17:48:05 +08:00
1 parent 1d9987181b
commit ac82b50571
33 files changed
+1328 -130

No files matched your search

+12 -1
View File
@@ -38,6 +38,17 @@ export interface LocalApiTestResponse {
contentType?: string
json?: unknown
bodyText?: string
errorCode?: 'API_NOT_RUNNING' | 'CONNECTION_REFUSED' | 'TIMEOUT' | 'INVALID_REQUEST' | 'UNKNOWN'
errorCode?:
| 'API_NOT_RUNNING'
| 'TOKEN_UNAVAILABLE'
| 'CONNECTION_REFUSED'
| 'TIMEOUT'
| 'INVALID_REQUEST'
| 'UNKNOWN'
error?: string
}
export interface LocalApiCurlCopyResult {
success: boolean
error?: string
}