Files
tootaio.com/docs/20251106/security.md
xiaomai 40b3ee147f 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.
2025-11-06 10:15:00 +08:00

1.2 KiB
Raw Blame History

安全审计与防护建议

发现与等级

  • 外链与配置Medium
    • 外部图片/链接硬编码在源码中;建议迁移到 runtimeConfig.public.assetBase 并集中管理。
  • 内容与校验High
    • Content Schema 与数据不一致会在构建期暴露为错误或导致运行时空值处理不当。
  • 依赖与脚本Low
    • 缺少 typecheck/lint 脚本,易让问题晚发现。

防护清单

  1. 运行时配置Medium
    export default defineNuxtConfig({
      runtimeConfig: {
        // 仅服务器可见
        sentryDsn: '',
        // 客户端可见
        public: {
          assetBase: 'https://img.tootaio.com',
        },
      },
    })
    
  2. 安全头(建议由网关/Nginx 配置Low
    • Content-Security-Policy(允许必要的域名);
    • X-Content-Type-Options: nosniffReferrer-Policy: strict-origin-when-cross-origin
    • 静态资源 Cache-Control: immutable
  3. 敏感信息检查Medium
    • 使用 .gitignore 与 CI 检查(如 trufflehog/gitleaks,后续可引入)。
  4. 依赖与锁定Low
    • 全量使用 pnpm-lock.yamlCI 中启用 --frozen-lockfile 保证可复现构建。