Skip to content

Commit 651f298

Browse files
committed
harden(cursor): default nativeLocalExec to codex-sandbox
Change the nativeLocalExec default from "off" to "codex-sandbox" so that Codex requests declaring the danger-full-access sandbox marker automatically enable native exec (read/write/shell/grep/ls/fetch). This is the intended posture for trusted local Codex→Cursor bridging: native tools work when Codex explicitly declares full-access sandbox, while remaining disabled for requests without the marker. Explicit config values ("off", "on") still override.
1 parent d70971f commit 651f298

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/adapters/cursor/exec-policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const CURSOR_SANDBOX_FULL_ACCESS_RE = /sandbox_mode[^\n]{0,80}danger-full
1010
export function resolveCursorNativeExecMode(provider: OcxProviderConfig): CursorNativeExecMode {
1111
const mode = provider.nativeLocalExec;
1212
if (mode === "off" || mode === "codex-sandbox" || mode === "on") return mode;
13-
return provider.unsafeAllowNativeLocalExec === true ? "on" : "off";
13+
return provider.unsafeAllowNativeLocalExec === true ? "on" : "codex-sandbox";
1414
}
1515

1616
/**

src/providers/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [
202202
authKind: "oauth",
203203
featured: false,
204204
dashboardPreset: true,
205-
note: "Experimental Cursor bridge. Live transport and live model discovery are enabled after a standalone PKCE browser login via 'ocx login cursor'; native read/write/delete/shell/fetch execution stays disabled unless you set \"nativeLocalExec\": \"on\" (always) or \"codex-sandbox\" (only for requests declaring the Codex danger-full-access sandbox; the declaration is caller-controlled prose the proxy cannot verify, and the auth-free loopback bind admits any process on this host, including other local users — enable only where every data-plane client is trusted) — legacy \"unsafeAllowNativeLocalExec\": true still means \"on\" — on providers.cursor in ~/.opencodex/config.json (dashboard: Providers → Cursor → Edit JSON) for a trusted local experiment.",
205+
note: "Experimental Cursor bridge. Live transport and live model discovery are enabled after a standalone PKCE browser login via 'ocx login cursor'; native read/write/delete/shell/fetch execution defaults to codex-sandbox mode (auto-enabled when the request declares Codex danger-full-access sandbox); override with \"nativeLocalExec\": \"on\" (always) or \"codex-sandbox\" (only for requests declaring the Codex danger-full-access sandbox; the declaration is caller-controlled prose the proxy cannot verify, and the auth-free loopback bind admits any process on this host, including other local users — enable only where every data-plane client is trusted) — legacy \"unsafeAllowNativeLocalExec\": true still means \"on\" — on providers.cursor in ~/.opencodex/config.json (dashboard: Providers → Cursor → Edit JSON) for a trusted local experiment.",
206206
models: cursorModelIds(CURSOR_STATIC_MODELS),
207207
liveModels: true,
208208
defaultModel: "auto",

tests/cursor-native-exec-policy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("Cursor native exec sandbox policy", () => {
6363
test.each([
6464
["explicit off beats legacy true", { ...baseProvider, nativeLocalExec: "off", unsafeAllowNativeLocalExec: true }, "off"],
6565
["legacy true alone", { ...baseProvider, unsafeAllowNativeLocalExec: true }, "on"],
66-
["no setting", baseProvider, "off"],
66+
["no setting", baseProvider, "codex-sandbox"],
6767
["explicit codex-sandbox", { ...baseProvider, nativeLocalExec: "codex-sandbox" }, "codex-sandbox"],
6868
] as const)("resolves mode: %s", (_name, provider, expected) => {
6969
expect(resolveCursorNativeExecMode(provider)).toBe(expected);

0 commit comments

Comments
 (0)