Commit f4ddfa3
authored
feat: u72ecu7acbu9875u52a8u6001u5bfcu822au3001u540eu53f0u4fa7u680fu56fau5b9au3001u79fbu52a8u7aefu4ee3u7801u5757u4f18u5316u3001u6807u7b7eu6298u53e0 (#40)
* fix(security): harden Monolith against XSS, SSRF, info leaks, and abuse
Critical/High:
- Sanitize custom_header/footer through DOMPurify before injection,
forbid inline scripts, only allow external script src (fixes #1)
- Add security headers: X-Content-Type-Options, X-Frame-Options,
Referrer-Policy, Permissions-Policy, HSTS (fixes #5)
- Remove authorEmail from public comment API, use DiceBear avatars
based on nickname instead of Gravatar hash (fixes #2, #14)
- Add login rate limiting: 5 attempts per 15 min per IP (fixes #3)
- Reflect request Origin in CORS instead of wildcard (fixes #4)
- Add SSRF protection for WebDAV backup and image localization:
only allow https://, block private/internal IPs (fixes #6, #13)
- Filter javascript: URIs in markdown link renderer (fixes #7)
Medium:
- Replace hardcoded reaction salt with REACTION_SALT env var (fixes #9)
- Add .env.* to .gitignore, remove .env.production from tracking (fixes #10)
- Disable source maps in production build (fixes #11)
- Remove infrastructure details from health endpoint (fixes #15)
* feat(privacy): add cookie consent banner, privacy policy page, and GDPR notice
- Add CookieConsent component: bottom banner with accept/reject,
stores consent in localStorage, fires 'cookie-consent-accepted'
event for third-party script injection gating
- Add /privacy route with full privacy policy page (bilingual)
- Gate custom_header/footer script injection behind cookie consent:
scripts only load after user accepts; non-script HTML injects
immediately as before
- Add GDPR warning in admin settings 'Extensions & Injection' tab
- Add PRIVACY.md to repo root
- Add privacy page link in cookie consent banner
* fix: 修复移动端代码块横向滚动崩坏问题
- code-block-wrapper 增加 -webkit-overflow-scrolling: touch(iOS 惯性滚动)
- pre 和 code 元素增加 white-space: pre 强制不换行,内容真实撑开 wrapper
- 移动端 pre 增加 width: max-content + min-width: 100% 确保可超出容器宽度
- code-line 从 display: inline-block 改为 display: block,避免 min-width: 100%
在移动端按父容器宽度错误计算导致代码不撑开横向滚动区域
- 兜底 pre:not(.hljs) 同步修复
* fix: 修复代码块布局坍塌(移除循环宽度依赖)
code-line 改回 display: inline-block,移除 width: max-content 和
min-width: calc(100%+8px) 的循环依赖写法(该写法导致移动端代码
内容完全消失)。pre 的 white-space: pre 已足够阻止换行,
wrapper 的 overflow-x: auto 负责横向滚动。
* feat: 独立页动态导航、后台侧栏固定、移动端代码块优化、标签折叠
- navbar: 从 /api/pages 获取 showInNav=true 的页面动态注入导航栏
- footer: 底部新增独立页面链接
- admin-layout: 侧栏改用 fixed 定位,彻底脱离文档流
- dashboard: 标签区折叠展开,默认显示2行+展开按钮
- globals.css: 移动端代码块优化(行号flex布局、顶栏sticky、尺寸缩减)
- .gitignore: 重写并清理不存在的条目
- 清理 .kilo 和 .playwright-mcp 残留
- 新增 AGENTS.md 和 opencode.json 项目配置
---------
Co-authored-by: one-ea <one-ea@users.noreply.github.com>1 parent 3aaa008 commit f4ddfa3
14 files changed
Lines changed: 347 additions & 238 deletions
File tree
- .kilo
- .playwright-mcp
- client/src
- components
- lib
- pages/admin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | | - | |
4 | 7 | | |
5 | | - | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | | - | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | | - | |
| 23 | + | |
18 | 24 | | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
| 28 | + | |
21 | 29 | | |
22 | | - | |
| 30 | + | |
23 | 31 | | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments