Skip to content

fix(connections): bound Claude settings reads during status and preview - #9130

Merged
lidge-jun merged 5 commits into
lidge-jun:devfrom
luvs01:codex/bounded-claude-home-status
Nov 27, 2026
Merged

lidge-jun merged 5 commits into
lidge-jun:devfrom
luvs01:codex/bounded-claude-home-status

Conversation

@luvs01

@luvs01 luvs01 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Bound the Claude settings data read by Connections and first-party preview to the existing 1 MiB status limit. Inspect the opened file and cap the bytes read through that same descriptor. Keep existing regular-file symlinks usable for these views and retain the default final-link policy for other bounded-file readers.

Switch-off previews also bound the optional NO_PROXY receipt and report unreadable input if they cannot predict restoration. A Desktop row with unreadable first-party settings now reports unknown. Apply, rollback, migration and removal continue using their existing contracts.

Verification

  • Windows, Bun 1.4.4: 11 focused connection, preview and shared-reader tests passed (26 assertions), one POSIX-specific route case skipped. The tests exercise regular files, byte limits, final-link policy, and both status routes. No live Claude home was used.
  • A broader Windows run of the connection, intercept-settings and switch-preview suites recorded 43 passes, two platform skips and eight failures. In the latter eight the test's actual switch could not prepare its local test CA (local_ca_path_unsafe). An isolated preview-file run had the same eight failures and passed the new receipt case. The unchanged base 5c827dc96 exhibited the same eight failing test names and the same CA error in a separate checkout. A second reviewer checked the bounded receipt reader and the unreadable Desktop-state mapping.
  • bun check --no-script --noEmit passed on 2,714 files. bun run structure:check, bun run privacy:scan and git diff --check passed. The full local suite was not run while this Windows host's shared test lane was busy. The PR CI provides the Linux regression run.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Updated the owning client-connections contract and regression tests.
  • Reviewed handling of settings, receipt data, and symlinks. No credentials or file content are exposed in the view or logs.

Summary by CodeRabbit

  • Bug Fixes
    • Claude Desktop connection status now shows as unknown in applicable cases when first-party settings cannot be safely read, rather than reporting native mode.
    • First-party shutdown previews show an unreadable status when settings or restoration receipts cannot be safely read. Missing optional receipts continue to allow previews.
    • Claude settings and receipts are checked against size and file-type limits before being read. Symlinks to regular files remain supported.
  • Documentation
    • Clarified file-read limits and status and preview behavior for unreadable files.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between da92f2c and 2e64459.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Claude status and preview paths now bound settings reads to 1 MiB through descriptor-validated regular-file reads, while preserving final symlinks to regular files. Shutdown previews also bound NO_PROXY receipt reads and refuse when bounded receipt reads fail. Tests and documentation cover these behaviors.

Changes: Claude bounded reads

Layer / File(s) Summary
Bounded regular-file reader
src/lib/bounded-file-read.ts, tests/lib/bounded-file-read.test.ts
The bounded reader can follow a final symlink when requested. It checks the opened file and its entry. Tests cover reading a symlink target and rejecting an entry identity mismatch.
Bounded settings inspection and status
src/claude/intercept/settings.ts, src/claude/desktop-first-party.ts, src/claude/connection-projection.ts, tests/server/connection-status-routes.test.ts, structure/clients/connections.md
Settings inspection accepts a read limit, and Claude status projections use the 1 MiB limit. Claude Desktop reports unknown for unreadable first-party settings under the described conditions. Tests and documentation cover bounded opens, symlink routing, and oversized settings.
Bounded preview and receipt reads
src/claude/first-party-preview.ts, src/claude/intercept/settings-no-proxy.ts, tests/claude-integration/claude-first-party-preview.test.ts
The shutdown preview bounds settings and NO_PROXY receipt reads. Bounded receipt read errors produce an unreadable refusal. Tests cover missing and oversized receipts.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · previous review da92f

This change bounds Claude settings and NO_PROXY receipt reads for status and preview views and reports unreadable or unknown states instead of reading unbounded files. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(connections): bound Claude settings reads during status and preview" matches the main change in the changeset. The raw summary and objectives show that Connections status and first-part…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(connections): bound Claude settings reads during status and preview" matches the main change in the changeset. The raw summary and objectives show that Connections status and first-party preview now read Claude settings through a bounded, descriptor-based reader capped at MAX_STATUS_SETTINGS_BYTES (1 MiB). The title names the scope (Connections status and preview) and the core change (bounded settings reads). It omits secondary changes such as NO_PROXY receipt bounds, Desktop unknown observation, and symlink handling, which the title does not need to cover.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f69af61 and da92f2c.

Files selected for processing: 1

  • src/claude/desktop-first-party.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@github-actions github-actions Bot added the bug Something isn't working label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@lidge-jun lidge-jun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on exact head 2e64459 (L4 gpt-6.1-terra r3 APPROVE, 46 focused tests + typecheck/structure/privacy, 0 unresolved threads, exact-head CI 29/29 green). Merging into dev.

@lidge-jun
lidge-jun merged commit f170198 into lidge-jun:dev Nov 27, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants