Repository navigation
[Codex Security] Racy Claude-home check can freeze the proxy #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ import { inspectDesktopFirstParty, observeClaudeDesktopMode, resolveClaudeDeskto | |
| import { previewClaudeFirstPartySettings } from "./first-party-preview"; | ||
| import { firstPartyDesired, firstPartyProxyStatus } from "./first-party-settings"; | ||
| import { claudeInterceptEnabled } from "./intercept/runtime"; | ||
| import { claudeSettingsFileState } from "./intercept/settings"; | ||
| import { claudeSettingsFileState, MAX_STATUS_SETTINGS_BYTES } from "./intercept/settings"; | ||
|
|
||
| export interface ClaudeConnectionInput { | ||
| live: OcxConfig; | ||
|
|
@@ -31,7 +31,8 @@ export interface ClaudeConnectionInput { | |
|
|
||
| function claudeCodeRow(input: ClaudeConnectionInput, dir: string, source: "default" | "extra", ordinal?: number): ConnectionView { | ||
| const { live } = input; | ||
| const options = { claudeConfigDir: dir, ...(input.opencodexConfigDir ? { opencodexConfigDir: input.opencodexConfigDir } : {}) }; | ||
| const options = { claudeConfigDir: dir, settingsReadLimit: MAX_STATUS_SETTINGS_BYTES, | ||
| ...(input.opencodexConfigDir ? { opencodexConfigDir: input.opencodexConfigDir } : {}) }; | ||
| const settingsPath = join(dir, "settings.json"); | ||
| const fileState = claudeSettingsFileState(dir); | ||
| if (fileState === "unsafe") { | ||
|
|
@@ -84,7 +85,8 @@ function claudeCodeRow(input: ClaudeConnectionInput, dir: string, source: "defau | |
|
|
||
| function claudeDesktopRow(input: ClaudeConnectionInput): ConnectionView { | ||
| const { live } = input; | ||
| const options = input.opencodexConfigDir ? { opencodexConfigDir: input.opencodexConfigDir } : {}; | ||
| const options = { settingsReadLimit: MAX_STATUS_SETTINGS_BYTES, | ||
| ...(input.opencodexConfigDir ? { opencodexConfigDir: input.opencodexConfigDir } : {}) }; | ||
|
Comment on lines
+88
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Unreadable Claude Desktop settings are reported as native routing With first-party mode pinned and no gateway profile selected, settings over 1 MiB now read as Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| const wanted = claudeDesktopIntegrationEnabled(live); | ||
| const observation = observeClaudeDesktopMode(live, options); | ||
| const mode = resolveClaudeDesktopMode(live, observation); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,15 @@ describe("readBoundedRegularFileSync", () => { | |
| expect(() => readBoundedRegularFileSync(link, 64)).toThrow(); | ||
| }); | ||
|
|
||
| test.skipIf(!canCreateFileSymlink())("follows a final symlink only when requested", () => { | ||
| const path = join(root, "target.json"); | ||
| writeFileSync(path, "fixture"); | ||
| const link = join(root, "linked.json"); | ||
| symlinkSync(path, link, "file"); | ||
| expect(readBoundedRegularFileSync(link, 64, { followFinalSymlink: true }).toString("utf8")) | ||
| .toBe("fixture"); | ||
| }); | ||
|
Comment on lines
+120
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 The regression tests do not exercise a file changing during open The new test follows a stable symlink, and the existing FIFO tests start with a FIFO already in place. Add a focused test that gives the symlink-following reader different identities before and after open, then verify that it rejects the read and closes the descriptor. Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| test.skipIf(process.platform === "win32")("rejects a FIFO without blocking", () => { | ||
| const fifo = join(root, "input.pipe"); | ||
| const created = spawnSync("mkfifo", [fifo], { timeout: 2_000 }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve
unknownwhen the Desktop settings read exceeds the cap.If
desktopModeis"first-party"and the Desktop library is"standard"or"no_owned_state", the new cap can makeinspectDesktopFirstPartyreturn"unreadable". Line 102 then reports"native"with owner"none". For example, valid owned settings larger than 1 MiB previously reported"proxy"but now report"native"without any routing change.Handle
settings.kind === "unreadable"as"unknown"before the proxy/native selection. Keep"proxy"for"applied"and"stale". Add a regression test with an explicit first-party mode and oversized owned settings. This also preserves the documented unknown outcome for refused settings reads.