docs(memory): 记录审计结论(CSP 默认 enforce、分享卡字体限制、复查新发现)
- topics/sec.md:两轮修复的结论、全局复查新发现(私聊 POST 越权、页面密码 next)、 CSP 白名单口径、字体只能用 glyf 轮廓这条硬限制,以及复现脚本的两种「假红」 - MEMORY.md:安全小节补跳转白名单、GET/POST 校验不对称、CSP/umami、注册防枚举 - 2026-10-27.md / topics/build.md:本地 WSL 部署与验收的具体跑法
This commit is contained in:
@@ -32,3 +32,31 @@
|
||||
(`go version` 显示的还是 shell 包装器的版本,容易误判成「版本没变」)。
|
||||
解法:直接用缓存里的 toolchain 并禁用自动切换——
|
||||
`PATH="$HOME/go/pkg/mod/golang.org/[email protected]/bin:$PATH" GOTOOLCHAIN=local go test ./...`
|
||||
|
||||
## 本地部署(WSL2 Debian,2026-10-27 打通)
|
||||
|
||||
用户本机有 WSL2 `Debian`(可 `wsl.exe -d Debian -u root` 免密进 root)。在这上面跑通了完整服务,
|
||||
从此 HTTP 端到端不必「部署到测试站才能做」。要点:
|
||||
|
||||
- **GOROOT 是个坑**:`~/.bashrc` 里 `export GOROOT=/usr/local/go`(1.26.3)。用 `/opt/go/bin/go`
|
||||
(1.27.3,从 dl.google.com 下的 tar 解到 /opt)时必须 `env -u GOROOT`,否则
|
||||
`compile: version "go1.26.3" does not match go tool version "go1.27.3"`。
|
||||
另:GOCACHE 被旧版本编译过也会报同样的错 → 换独立 `GOCACHE=~/.cache/go-build-tb`。
|
||||
- **依赖**:`apt-get install redis-server python3 python3-requests gcc libwebp-dev pkg-config`
|
||||
(有 libwebp 后 `internal/storage/s3.go` 正常编译,不再需要 s3stub overlay)。
|
||||
session 与 cache 都硬依赖 redis,6379 不通就起不来;`systemctl start redis-server` 即可(WSL 有 systemd)。
|
||||
- **库**:DSN 不带库名 → 连的是与用户名同名的库。测试还要 `CREATEDB` 权限(`NewTestDB` 自建临时库)。
|
||||
`CREATE ROLE tamabox LOGIN PASSWORD '...' CREATEDB; CREATE DATABASE tamabox OWNER tamabox;
|
||||
CREATE DATABASE nekobox OWNER tamabox; CREATE SCHEMA nekobox AUTHORIZATION tamabox;`
|
||||
- **配置坑**:`data/data.txt` 里的 `[app] title`、`[server] xsrf_expire`、`[captcha] provider`、
|
||||
`[rate_limit] *` 全是当前版本不认识的键(启动 WARN 后忽略)。验证码要关外网校验得写
|
||||
`[recaptcha] captcha_type = math`。`external_url` 用 http → session cookie 不带 Secure,本地能登录。
|
||||
- **进程托管**:`/etc/systemd/system/tamabox-test.service`(User=tamakyi、WorkingDirectory=源码目录、
|
||||
ExecStart=<二进制> web、日志 append 到文件)。`systemctl restart` 必须 root,普通用户报 Access denied。
|
||||
- **访问路径**:Windows 侧 `http://127.0.0.1:5877` 被本机别的进程占用(返回 502),要用
|
||||
`http://<wsl eth0 ip>:5877`。这个差异正好白送一套 P1-3 的 A/B:
|
||||
WSL 内 `curl 127.0.0.1` = 回环对端(模拟 cloudflared 回源),Windows 侧访问 = 非回环对端(模拟公网直连)。
|
||||
- **抓 IP 伪造**:临时配 `ip_blacklist = 1.2.3.4` + `ip_blacklist_redirect_url`,带头 curl 看有没有 302,
|
||||
比读日志直观;配合日志里的 `remote_addr` / `header_ip` 双重取证。
|
||||
- **限流会绊脚本**:`/api/captcha/generate` 按 IP 限流,批量跑用例会 429,
|
||||
`audit.get_captcha` 已加退避重试。SMTP 密码不对只会打日志(`526 Authentication failure`),不影响用例。
|
||||
|
||||
Reference in New Issue
Block a user