mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 19:47:08 +08:00
feat: 为本地 HTTP API 增加 Token 鉴权与安全加固
- 使用 Electron safeStorage 加密存储并自动初始化 API Token - 为 health 以外的接口增加 Bearer Token 鉴权 - 限制 CORS 仅允许可信本地 Origin - 增加鉴权、Token rotation、safeStorage 和手动验收测试
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
API_TOKEN_ROTATION_CONFIRMATION,
|
||||
confirmApiTokenRotation
|
||||
} from '../../src/renderer/src/features/api-center/utils/confirmApiTokenRotation'
|
||||
|
||||
describe('API token rotation confirmation', () => {
|
||||
it('requires explicit confirmation and explains immediate invalidation', () => {
|
||||
const reject = vi.fn(() => false)
|
||||
expect(confirmApiTokenRotation(reject)).toBe(false)
|
||||
expect(reject).toHaveBeenCalledWith(API_TOKEN_ROTATION_CONFIRMATION)
|
||||
expect(API_TOKEN_ROTATION_CONFIRMATION).toContain('旧 Token 将立即失效')
|
||||
expect(API_TOKEN_ROTATION_CONFIRMATION).toContain('Agent / Reader Skill 需要更新 Token')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user