security: 安全审计修复 - API Key清理 + JWT改为HttpOnly Cookie
- API Key: run.md/.env/seed_model_providers.sql 中明文Key替换为占位符 - 认证: JWT从localStorage迁移到HttpOnly Cookie,移除后端body返回token - 前端: api.ts/knowledge/page.tsx/auth.ts 全面改用Cookie认证 - postcss XSS: package.json添加overrides强制升级到8.5.15 - gitignore: 添加server/.env和.env排除规则 - lint: 移除tenant.go中未使用的roleKey常量 - 文档: 新增docs/security-audit-report.md和hardware-requirements.md
This commit is contained in:
@@ -19,8 +19,6 @@ setup("登录法制日报账号并保存会话", async ({ page }) => {
|
||||
|
||||
await page.waitForURL(/\/store/, { timeout: 30_000 });
|
||||
|
||||
const token = await page.evaluate(() => localStorage.getItem("token"));
|
||||
expect(token, "登录后应在 localStorage 写入 token").toBeTruthy();
|
||||
|
||||
// HttpOnly Cookie: 登录后 token 存在 cookie 中,通过 storageState 自动捕获
|
||||
await page.context().storageState({ path: AUTH_FILE });
|
||||
});
|
||||
Reference in New Issue
Block a user