You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(connections): bound Claude settings reads during status and preview - #9130
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.
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.
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.
lidge-jun/opencodex#9108: Adds the connection status and first-party preview read paths that this PR updates.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
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
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
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
local_ca_path_unsafe). An isolated preview-file run had the same eight failures and passed the new receipt case. The unchanged base5c827dc96exhibited 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 --noEmitpassed on 2,714 files.bun run structure:check,bun run privacy:scanandgit diff --checkpassed. 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
Summary by CodeRabbit