docs(engineering): add project audit report and improvement plan
This commit introduces a comprehensive engineering audit report for the Tootaio Studio project. The report is structured into documents covering architecture, code quality, performance, security, CI/CD, and observability. It also includes a phased improvement roadmap and a set of `.patch` files to apply immediate fixes for content schemas, package scripts, and CI configuration.
This commit is contained in:
33
docs/20251106/security.md
Normal file
33
docs/20251106/security.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 安全审计与防护建议
|
||||
|
||||
## 发现与等级
|
||||
- 外链与配置(Medium)
|
||||
- 外部图片/链接硬编码在源码中;建议迁移到 `runtimeConfig.public.assetBase` 并集中管理。
|
||||
- 内容与校验(High)
|
||||
- Content Schema 与数据不一致会在构建期暴露为错误或导致运行时空值处理不当。
|
||||
- 依赖与脚本(Low)
|
||||
- 缺少 `typecheck`/`lint` 脚本,易让问题晚发现。
|
||||
|
||||
## 防护清单
|
||||
1) 运行时配置(Medium)
|
||||
```ts
|
||||
export default defineNuxtConfig({
|
||||
runtimeConfig: {
|
||||
// 仅服务器可见
|
||||
sentryDsn: '',
|
||||
// 客户端可见
|
||||
public: {
|
||||
assetBase: 'https://img.tootaio.com',
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
2) 安全头(建议由网关/Nginx 配置)(Low)
|
||||
- `Content-Security-Policy`(允许必要的域名);
|
||||
- `X-Content-Type-Options: nosniff`、`Referrer-Policy: strict-origin-when-cross-origin`;
|
||||
- 静态资源 `Cache-Control: immutable`。
|
||||
3) 敏感信息检查(Medium)
|
||||
- 使用 `.gitignore` 与 CI 检查(如 `trufflehog`/`gitleaks`,后续可引入)。
|
||||
4) 依赖与锁定(Low)
|
||||
- 全量使用 `pnpm-lock.yaml`,CI 中启用 `--frozen-lockfile` 保证可复现构建。
|
||||
|
||||
Reference in New Issue
Block a user