Skip to content

fix(headers): baseline security response headers across all three deploy targets - #12

Merged
Jerry-CodeHub merged 1 commit into
masterfrom
fix/security-headers
Sep 23, 2026
Merged

Jerry-CodeHub merged 1 commit into
masterfrom
fix/security-headers

Conversation

@Jerry-CodeHub

Copy link
Copy Markdown
Owner

背景

审计 2026-09-22 H-3:三条部署产线中两条零安全响应头,Docker 产线缺 CSP/Permissions-Policy。无 CSP 意味着一旦出现 XSS 或第三方域劫持(如高德 JSONP 以页面全权限执行),没有任何纵深防御。

产线 修复前 修复后
Vercel 全部缺失 headers 块:nosniff / Referrer-Policy / XFO / Permissions-Policy / CSP
GitHub Pages 全部缺失 产物内 meta CSP(平台无法自定义响应头)
Docker 3 头,无 CSP + Permissions-Policy + CSP(Report-Only 观察一轮后转正式)

CSP 设计要点

  • 来源清单按产物逐域核实(非猜测):高德/autonavi、Cesium ion、OSM 瓦片、virtualearth.net(未配 ion token 时的 Bing 影像兜底——回归实测抓到的缺口)、alicdn appList 图标、演示视频 CDN
  • 'unsafe-eval' 保留:Cesium Knockout 模板编译用 new Function(实测在用);pdfjs 已关 isEvalSupported
  • meta CSP(GH Pages)不含 frame-ancestors(meta 版不支持),README 声明该平台限制
  • README 部署节补充三产线安全头基线说明

验证(headless 浏览器,github 产线子路径静态服务)

  • 登录 → Home 五张图表 canvas → Cesium geoHash(Knockout 编译通过、canvas 渲染)→ TinyMCE iframe:零 CSP violation、零请求拦截
  • 仅剩的拦截是 http:// Bing 瓦片(Cesium uriScheme 跟随页面协议,仅本地 http 环境出现;生产 https 自动走 https 瓦片),已在 nginx 注释中记录
  • pnpm check 全绿

合并后 nginx 的 Report-Only 建议观察一个迭代再转正式(去掉 -Report-Only 后缀即可)。

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d13fb6e1-2898-485e-b6e2-1b062c4e07e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8e537c4 and 6ccbedf.

📒 Files selected for processing (4)
  • README.md
  • config/config.github.ts
  • nginx/security-headers.conf
  • vercel.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying umi-react-admin with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6ccbedf
Status: ✅  Deploy successful!
Preview URL: https://2a977063.umi-react-admin.pages.dev
Branch Preview URL: https://fix-security-headers.umi-react-admin.pages.dev

View logs

@Jerry-CodeHub
Jerry-CodeHub merged commit 071ba06 into master Sep 23, 2026
5 checks passed
@Jerry-CodeHub
Jerry-CodeHub deleted the fix/security-headers branch September 23, 2026 00:11
…loy targets

audit 2026-09-22 H-3: vercel and github pages shipped zero security
headers, docker lacked CSP/permissions-policy

- vercel.json: nosniff / referrer-policy / XFO / permissions-policy /
  CSP via a headers block on all routes
- nginx: permissions-policy + CSP as Report-Only for one iteration
  (source list verified per-domain against the built artifact), HSTS
  left as a documented example behind TLS termination
- config.github.ts: meta CSP (platform cannot set response headers);
  umi replaces the metas array wholesale so the viewport entry is
  carried over explicitly
- CSP source list: amap/autonavi JSONP, cesium ion, OSM tiles,
  virtualearth bing fallback, alicdn app icons, demo video CDN;
  'unsafe-eval' retained for cesium knockout template compilation
  (verified in use), pdfjs runs with isEvalSupported:false

verified in a headless browser against the github build served at its
/umi-react-admin/ subpath: login -> home charts (5 canvases) -> cesium
geoHash (canvas renders, knockout compiles) -> tinymce iframe, zero
CSP violations on https sources; the only remaining blocks are
http:// bing tiles that only occur when the page itself is served over
http (uriScheme follows page protocol)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant