关闭生产环境浏览器 Source Maps
避免 /_next/static/**/*.js.map 将完整 TypeScript 源码与内部路由暴露给外部抓取。
next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
productionBrowserSourceMaps: false,
poweredByHeader: false,
};
export default nextConfig;
强制开启 Supabase 行级安全(RLS)
防止前端暴露 anon key 后导致 PostgREST 数据表被未鉴权读取。
supabase-rls.sql
-- Lock down public tables accessed via NEXT_PUBLIC_SUPABASE_ANON_KEY
ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users read own profile only"
ON public.profiles FOR SELECT
USING (auth.uid() = id);
启用强制 DMARC 防止仿冒与进垃圾箱
从 p=none 升级至执行策略,满足 Gmail 与 Yahoo 发信合规要求。
_dmarc TXT 记录
; DNS TXT record for _dmarc.yourdomain.com (TTL 300)
; Start at p=quarantine, monitor RUA reports 14 days, then upgrade to p=reject
v=DMARC1; p=quarantine; sp=quarantine; pct=100; adkim=r; aspf=r; rua=mailto:dmarc@yourdomain.com
一次性补齐核心安全响应头与 HSTS
通过 HSTS preload、CSP、防点击劫持与防嗅探彻底消除 0/5 响应头缺口。
vercel.json
{
"headers": [{
"source": "/(.*)",
"headers": [
{ "key": "Strict-Transport-Security", "value": "max-age=63072000; includeSubDomains; preload" },
{ "key": "Content-Security-Policy", "value": "default-src 'self'; object-src 'none'; frame-ancestors 'none'" },
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }
]
}]
}
发布标准 Markdown /llms.txt 索引
为 ChatGPT、Claude 与 Perplexity 提供高信噪比的产品、文档与定价事实地图。
public/llms.txt
# YourApp — Concise Product Summary for AI Assistants
> One-sentence factual description of what your app does, who it serves, and its primary live URL.
## Core Pages
- Documentation: https://yourdomain.com/docs
- Pricing: https://yourdomain.com/#pricing
- Security & Status: https://yourdomain.com/security
5 行 GitHub Action 守住每次上线
在代码合入生产前自动拦截响应头、密钥泄露、DMARC 与 AI 爬虫回退。
.github/workflows/shipbastion.yml
name: ShipBastion Pre-Launch Gate
on: [push, pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: zColdWater/shipbastion-action@v1
with:
url: https://yourdomain.com
fail-below-grade: B