Skip to content

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

Open
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:codex/bounded-claude-home-status
Open

luvs01 wants to merge 1 commit 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 connection status now reports an unknown state when settings cannot be safely read, rather than incorrectly implying native settings are active.
    • First-party shutdown previews now refuse with 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 the status and preview behavior for unreadable files.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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, and a test verifies reading the symlink target.
Bounded settings inspection and status
src/claude/intercept/settings.ts, src/claude/connection-projection.ts, src/claude/desktop-first-party.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. 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: Low · up to de675

Claude status and preview reads are now bounded to 1 MiB. In one narrow case, an unpinned Claude Desktop row with oversized owned settings may show "native" instead of "unknown". This affects display only and is safe to follow up after merge.

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 PR caps Claude settings reads at MAX_STATUS_SETTINGS_BYTES for Connect…
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 PR caps Claude settings reads at MAX_STATUS_SETTINGS_BYTES for Connections status and first-party preview, reads through the opened file descriptor, and adds a bounded NO_PROXY receipt read. The title is specific, concise, and follows the conventional commit format.

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 5c827dc and de6759a.

Files selected for processing: 10

  • src/claude/connection-projection.ts
  • src/claude/desktop-first-party.ts
  • src/claude/first-party-preview.ts
  • src/claude/intercept/settings-no-proxy.ts
  • src/claude/intercept/settings.ts
  • src/lib/bounded-file-read.ts
  • structure/clients/connections.md
  • tests/claude-integration/claude-first-party-preview.test.ts
  • tests/lib/bounded-file-read.test.ts
  • tests/server/connection-status-routes.test.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

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@luvs01
luvs01 marked this pull request as ready for review November 25, 2026 09:16

This branch has not been deployed

No deployments
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.

1 participant