[security] fix(daemon): keep daemon config private#214
Merged
steipete merged 2 commits intoMay 8, 2026
Conversation
steipete
approved these changes
May 8, 2026
Owner
steipete
left a comment
There was a problem hiding this comment.
Maintainer fixup pushed in 7f90d26: kept the private directory/file modes from the PR, added a pre-write chmod so existing loose daemon configs are tightened before rewriting token/env secrets, and added changelog coverage.
Verified locally: pnpm -s test tests/daemon.config.test.ts; pnpm -s check; pnpm -s build. Remote CI is green on 7f90d26, including test/build/pack and extension-e2e.
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
This PR hardens daemon credential storage by ensuring the generated daemon config directory and config file are private on POSIX filesystems.
The daemon config can contain bearer tokens used by the local daemon and an environment snapshot with provider credentials such as API keys. This change makes the default write path secure-by-default and repairs previously loose permissions when the config is rewritten.
Security issues covered
~/.summarize/daemon.jsonBefore this PR
writeDaemonConfig(...)created~/.summarizewith default directory permissions.daemon.jsonwas written with default file creation permissions.After this PR
~/.summarizeis created with0700permissions.daemon.jsonis written with0600permissions.chmodafter writing.0755/0644paths are tightened to0700/0600.Why this matters
The daemon config is a local credential boundary. It can contain:
/v1/*daemon authorizationIf this file is readable by another local account, that account can recover secrets that were intended to stay within the owner account. The daemon token may also allow local requests against the victim's daemon while it is running.
Attack flow
Affected code
src/daemon/config.ts,tests/daemon.config.test.tsRoot cause
Daemon config file created with default filesystem permissions:
fs.mkdir(..., { recursive: true })andfs.writeFile(..., "utf8")without explicit private modes.CVSS assessment
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:NRationale:
Safe reproduction steps
On a Unix-like system, create a loose config directory and file:
Trigger a daemon config write through the existing config-writing path.
On vulnerable code, observe that the config path can remain readable beyond the owning user depending on umask/existing permissions.
With this PR, run the regression test and observe that both permissions are tightened.
Expected vulnerable behavior
~/.summarize/daemon.jsoncould be created or left with non-private permissions.Changes in this PR
0o700.0o700.daemon.jsonwith0o600.0o600after writing.Files changed
src/daemon/config.tstests/daemon.config.test.tswriteDaemonConfig(...)Maintainer impact
chmodfailures are ignored intentionally so Windows and filesystems without POSIX mode support continue to work.Fix rationale
The daemon config stores secrets, so the durable boundary should be the filesystem owner account. Setting private creation modes and repairing existing loose permissions is a small, durable defense that matches how local credential files are typically handled.
Type of change
Test plan
pnpm install --frozen-lockfilepnpm -s format:check src/daemon/config.ts tests/daemon.config.test.tspnpm -s lint src/daemon/config.ts tests/daemon.config.test.tspnpm exec vitest run tests/daemon.config.test.tspnpm -C packages/core -s buildpnpm -s typecheckpnpm -s testgit diff --checkNote: local validation ran under Node
v22.22.2; the repository declaresnode >=24, so pnpm emitted engine warnings, but the commands above completed successfully.Disclosure notes
SECURITY.mdfile in the checkout.