fix(oauth): preserve ownership for custom slot credentials - #219
Open
zhoudashuaibi wants to merge 1 commit into
Open
zhoudashuaibi wants to merge 1 commit into
zhoudashuaibi wants to merge 1 commit into
Conversation
Reuse the runtime owner mapping for any slot id so startup subscription migration and credential rewrites do not publish root-owned files for custom-named slots. Add regression coverage for custom slot home paths.
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.
变更
修复自定义槽位名称的 OAuth 凭证属主推导。
slotUidGidFromHomeDir()现在接受任意合法槽位目录名,并复用slotRuntimeOwner()的 UID/GID 规则;因此启动时的subscriptionType迁移和重新授权写入不会再把新凭证文件留在root:root。Fixes #218
根因
从
v1.3.93开始,服务启动会原子重写缺少subscriptionType的credentials.json。旧逻辑只识别vm-数字目录,自定义槽位如claude-ios-145无法完成chown,槽容器 UID/GID10001:987随后无法读取凭证并返回credential_required/needs_refresh401。验证
npx biome formatnode --check(src、scripts)node --test --test-name-pattern "ensureSlotSubscriptionType|slotUidGidFromHomeDir|ensureSlotClaudeOwnership" test/unit/oauth-credentials.test.mjsgit diff --check完整
npm run test:unit在 Windows 本地受到既有 symlink、SQLiteEBUSY和 Unix socketEACCES环境限制;Ubuntu CI 将执行完整套件。未发起任何 Claude 模型请求。