fix: harden daemon discovery file trust#65
Draft
Disaster-Terminator wants to merge 1 commit into
Draft
Conversation
Reviewer's Guide在守护进程发现文件读取周围添加基于 POSIX 的所有权与权限检查,并确保发现状态目录/文件以安全模式创建,同时附带回归测试和重新构建的 dist 产物。 Sequence diagram for secured daemon discovery readsequenceDiagram
actor User
participant DaemonClient
participant discovery_module
participant fs
User->>DaemonClient: requestDaemonDiscovery(stateDir)
DaemonClient->>discovery_module: readDaemonDiscovery(stateDir)
discovery_module->>discovery_module: getDaemonDiscoveryPath(stateDir)
discovery_module->>discovery_module: assertDiscoveryPathSecure(filePath)
discovery_module->>fs: lstat(filePath), lstat(dirname(filePath))
fs-->>discovery_module: fileStat, dirStat
discovery_module->>discovery_module: assertSecureDiscoveryStats(fileStat, dirStat)
discovery_module->>fs: readFile(filePath, "utf8")
fs-->>discovery_module: discoveryJson
discovery_module->>discovery_module: normalizeDiscovery(parsed)
discovery_module-->>DaemonClient: DaemonDiscovery
DaemonClient-->>User: secured daemon endpoint
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 来:
Getting HelpOriginal review guide in EnglishReviewer's GuideAdds POSIX-based ownership and permission checks around daemon discovery file reads and ensures discovery state directories/files are created with secure modes, with accompanying regression tests and rebuilt dist artifacts. Sequence diagram for secured daemon discovery readsequenceDiagram
actor User
participant DaemonClient
participant discovery_module
participant fs
User->>DaemonClient: requestDaemonDiscovery(stateDir)
DaemonClient->>discovery_module: readDaemonDiscovery(stateDir)
discovery_module->>discovery_module: getDaemonDiscoveryPath(stateDir)
discovery_module->>discovery_module: assertDiscoveryPathSecure(filePath)
discovery_module->>fs: lstat(filePath), lstat(dirname(filePath))
fs-->>discovery_module: fileStat, dirStat
discovery_module->>discovery_module: assertSecureDiscoveryStats(fileStat, dirStat)
discovery_module->>fs: readFile(filePath, "utf8")
fs-->>discovery_module: discoveryJson
discovery_module->>discovery_module: normalizeDiscovery(parsed)
discovery_module-->>DaemonClient: DaemonDiscovery
DaemonClient-->>User: secured daemon endpoint
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Motivation
Description
assertDiscoveryPathSecureandassertDiscoveryPathSecureSyncthat verify the discovery file is a regular file, owned by the current user, not group/other-readable or writable, and that the state directory is not group/other-writable (no-op on Windows). (editedsrc/daemon/discovery.ts)mode: 0o700inwriteDaemonDiscovery). (editedsrc/daemon/discovery.ts)tests/daemon-discovery.test.ts)Testing
pnpm exec vitest run --maxWorkers=1 tests/daemon-discovery.test.ts tests/mcp-tools.test.tsand all tests passed.pnpm run typechecksucceeded.pnpm run buildsucceeded and updateddist/andplugins/retinue/dist/outputs.Codex Task
Summary by Sourcery
通过对发现文件及其状态目录强制安全的所有权与权限设置,加强守护进程发现元数据的处理。
Bug Fixes:
Enhancements:
Tests:
Original summary in English
Summary by Sourcery
Harden daemon discovery metadata handling by enforcing secure ownership and permissions on discovery files and their state directories.
Bug Fixes:
Enhancements:
Tests: