Skip to content

fix(daemon): timing-safe token comparison, daemon.json hardening, shell-quote CVE#731

Merged
thymikee merged 2 commits into
mainfrom
claude/daemon-token-hardening
Jun 10, 2026
Merged

fix(daemon): timing-safe token comparison, daemon.json hardening, shell-quote CVE#731
thymikee merged 2 commits into
mainfrom
claude/daemon-token-hardening

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Three small security hardenings from the technical audit (#722):

  • Daemon token checks now use crypto.timingSafeEqual over SHA-256 digests (length-independent, no early-exit timing signal) instead of ===/!== — new src/utils/timing-safe-equal.ts, wired into the two router checks and the HTTP auxiliary-endpoint check. Matters more now that network-fronted daemon deployments are near.
  • daemon.json (contains the daemon auth token) is chmod'd to 0600 after every write; writeFileSync's mode only applies on file creation, so a pre-existing looser-permission file previously kept its permissions.
  • Clears the repo's one open critical Dependabot alert, CVE-2026-9277 (shell-quote@1.8.3 via react-native > react-devtools-core in the test app). The override is added to examples/test-app/pnpm-workspace.yaml — not package.json, where overrides for this nested app are silently ignored (see the comment in that file / fix: resolve test-app dependabot alerts #649). The lockfile diff is limited to shell-quote 1.8.3 → 1.8.4.

Touched files: 6 (4 src, 2 example-app manifests).

Validation

Full unit suite green (2,159 passed), daemon smoke tests green (8/8 — these spawn the real daemon, exercising both token enforcement and the info-file write path), typecheck/lint/format clean, and pnpm audit in examples/test-app now reports zero vulnerabilities (previously 1 critical).

Part of #722.

https://claude.ai/code/session_01LXZXzxi55sZ11DSyqWyBA2


Generated by Claude Code

claude added 2 commits June 10, 2026 07:08
…hardening

Use crypto.timingSafeEqual (via SHA-256 digests, length-independent) for the
three daemon token checks, and chmod daemon.json to 0600 after writes since
writeFileSync only applies mode on creation.

https://claude.ai/code/session_01LXZXzxi55sZ11DSyqWyBA2
…n test-app

Override added to examples/test-app/pnpm-workspace.yaml (package.json-level
overrides are silently ignored for this nested app, see the comment there).
Lockfile change is limited to shell-quote 1.8.3 -> 1.8.4; pnpm audit is clean.

https://claude.ai/code/session_01LXZXzxi55sZ11DSyqWyBA2
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.2 MB 1.2 MB +167 B
JS gzip 381.5 kB 381.5 kB +53 B
npm tarball 492.9 kB 492.9 kB +54 B
npm unpacked 1.7 MB 1.7 MB +167 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.8 ms 27.4 ms +0.6 ms
CLI --help 42.6 ms 43.0 ms +0.4 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/2415.js +167 B +53 B

@thymikee

Copy link
Copy Markdown
Member Author

Merge blocker: the iOS Smoke Tests check is red. The log shows prepare ios-runner --platform ios --timeout 300000 --json timing out with Daemon request timed out after the simulator was already booted. This may be CI/device flake rather than a token-hardening regression, but it should be rerun or inspected via the uploaded ios-artifacts before merging.

@thymikee thymikee merged commit 4f95ca8 into main Jun 10, 2026
17 of 18 checks passed
@thymikee thymikee deleted the claude/daemon-token-hardening branch June 10, 2026 09:00
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-10 09:00 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants