fix: 路由编辑身份认证四处修补——0 超时放行、摘要配对、凭据格式当场点名 - #101
Merged
Merged
Conversation
审计发现的四件小事,一起收了: 1. forwardAuth 鉴权请求超时填 0 曾被静默丢回默认:NUMERIC_BOUNDS 的 min 是 1,和「0 = 不设限」的文案打架。min 改 0,schema 与运行时早已放行。 2. 生成卡里明文旁边补上摘要栏:多把 key 并存时,「哪串哈希属于哪把明文」 只有这对并排的值能说清。各带复制钮,摘要进列表的路径不变。 3. 凭据格式本地校验补齐:team/keys/header 与服务端 config.ts 逐字符同正则, 邮箱只拦一眼能看出来的错(判定归 /api/preview)。错误经 FieldErrors 走 既有通道:字段旁红字 + 页脚索引,保存按钮禁用。 4. 顺手清掉早已无人引用的死文案 keyManualHint。 测试:超时 0 落库、坏凭据四错齐现且保存禁用、合法值放行、生成后明文/摘要 成对出现且摘要进 keys(jsdom 的 crypto.subtle 实测可用,走真的生成路径)。 Co-Authored-By: Claude <noreply@anthropic.com>
YoungSx
force-pushed
the
audit-route-editor-auth
branch
from
September 7, 2026 01:08
697b863 to
1a6a435
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
对路由编辑器的身份认证设计做了一轮审计,发现四处值得修的:一处静默丢数据、一处「两把分不清」、一处错误发现得太晚、一处死文案。本 PR 一次收齐。
修补内容
1. forwardAuth 鉴权请求超时填 0 不再被静默丢弃
文案写「0 = 不设限」,但
NUMERIC_BOUNDS.authTimeoutMs.min是 1——输入层直接把 0 换回默认,操作者以为设了不限时,实际是 2 秒。min 改为 0,与 schema(b311db1 已放行)和运行时口径对齐。2. 生成 key 后明文旁边给出对应摘要
access.keys存哈希。此前一把明文换出来就只剩一串哈希,列表里多把 key 时无法证明「这串哈希是刚才这把明文算的」。现在生成卡里明文下方并列展示摘要,各带复制钮;写进草稿的路径不变(仍是单次显示明文的前提)。3. 凭据格式在本地就开口
team / API key 摘要 / 自定义头名三条本地校验与服务端
config.ts逐字符同正则——本地意见与线上判定一致;邮箱只拦一眼能看出来的错(IDN、加号地址等边缘归/api/preview,不装权威)。错误走既有 FieldErrors 通道:字段旁红字 + 页脚错误索引,保存按钮禁用。4. 清掉死文案
keyManualHint生成按钮进来后就无人引用。
测试
saveDraft落库{ timeoutMs: 0 }keys(jsdom 的crypto.subtle实测可用,走真实生成路径)npm run check全绿(typecheck + lint + 全部测试)。🤖 Generated with Claude Code