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.
1.2 KiB
1.2 KiB
安全审计与防护建议
发现与等级
- 外链与配置(Medium)
- 外部图片/链接硬编码在源码中;建议迁移到
runtimeConfig.public.assetBase并集中管理。
- 外部图片/链接硬编码在源码中;建议迁移到
- 内容与校验(High)
- Content Schema 与数据不一致会在构建期暴露为错误或导致运行时空值处理不当。
- 依赖与脚本(Low)
- 缺少
typecheck/lint脚本,易让问题晚发现。
- 缺少
防护清单
- 运行时配置(Medium)
export default defineNuxtConfig({ runtimeConfig: { // 仅服务器可见 sentryDsn: '', // 客户端可见 public: { assetBase: 'https://img.tootaio.com', }, }, }) - 安全头(建议由网关/Nginx 配置)(Low)
Content-Security-Policy(允许必要的域名);X-Content-Type-Options: nosniff、Referrer-Policy: strict-origin-when-cross-origin;- 静态资源
Cache-Control: immutable。
- 敏感信息检查(Medium)
- 使用
.gitignore与 CI 检查(如trufflehog/gitleaks,后续可引入)。
- 使用
- 依赖与锁定(Low)
- 全量使用
pnpm-lock.yaml,CI 中启用--frozen-lockfile保证可复现构建。
- 全量使用