Repository navigation
Demo 命名回写·后端:PATCH 缺省/非法 body 显式 400 + migrations.ts 头注释修正 - #68
Merged
todosdev[bot] merged 1 commit intoNov 24, 2026
Merged
Conversation
- require string name on PATCH /api/me/passkeys/:id - require string label on PATCH /api/auth/2fa/totp/label - update header comment in migrations.ts to reflect incremental schema_v7 migration
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.
Summary
PATCH /api/me/passkeys/:id与PATCH /api/auth/2fa/totp/label传缺省{}或非字符串 body 时显式返回 400,防止静默清空名称或标签。worker/src/lib/migrations.ts头部注释中关于生产库跳过迁移的历史过时描述,与schema_v7增量补列和记账的现状保持一致。Changes
worker/src/routes/me.ts增加typeof body.name === "string"校验,未提供name属性或非字符串时返回 400INVALID_REQUEST。worker/src/routes/twofa-manage.ts增加typeof body.label === "string"校验,未提供label属性或非字符串时返回 400INVALID_REQUEST。worker/src/lib/migrations.ts更新头注释,明确单一基线schema_v1跳过、增量迁移schema_v7动态补齐并记账的生产库兼容行为。worker/test/passkey-name-totp-label.test.ts扩充用例,覆盖无请求体、{}、非字符串(数字/null/数组/对象)等全部边界均返回 400 且原值未被清空。Testing
pnpm --filter ./worker exec vitest run test/passkey-name-totp-label.test.ts:通过(4 passed)pnpm test:全量测试通过(Worker 223 passed,Web 180 passed)pnpm check:identity/pnpm typecheck/pnpm lint/pnpm format:check/pnpm check:deploy:全量通过