Skip to content

[WRONG BRANCH] fix(codex): single-flight prompt text probes to avoid concurrent subprocess floods - #354

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-cross-site-subprocess-flood-vulnerability
Draft

[WRONG BRANCH] fix(codex): single-flight prompt text probes to avoid concurrent subprocess floods#354
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-cross-site-subprocess-flood-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent overlapping Codex child processes and unbounded stdout buffers when the prompt panel is URL-addressable and mounted repeatedly.

Description

  • Add a module-level single-flight slot activeProbe so concurrent calls to probePromptText share one in-flight process-backed probe rather than spawning independent children (src/codex/prompt-text-probe.ts).
  • Refactor the probe entrypoint into performPromptTextProbe and make probePromptText wrap it to set/clear the activeProbe slot so the shared operation is cleared after success or failure (src/codex/prompt-text-probe.ts).
  • Preserve existing per-child bounds: the probe remains time- and byte-bounded (MAX_PROBE_OUTPUT_BYTES and the timeout are unchanged).
  • Add a regression test that asserts the single-flight admission and cleanup invariants (tests/codex-prompt-route.test.ts).

Testing

  • Ran bun run typecheck and it passed.
  • Ran focused GUI/management tests for the changed subsystem with bun scripts/test.ts tests/codex-prompt-route.test.ts tests/codex-prompt-text-probe.test.ts; the changed prompt-route and prompt-text-probe checks passed under the repository test runner (repo Bun v1.4.x).
  • Observed that a host bun test invocation using an older Bun (1.2.14) reported an unrelated node:zlib missing export (zstdDecompressSync) preventing that specific run; this is environment-specific and unrelated to the change.
  • Full test-run was exercised but exposed unrelated existing failures in the wider suite; the focused regression coverage for the probe behavior is green.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: db961d47-361a-48f5-b149-c8651c0d9931


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

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 28, 2026
@github-actions github-actions Bot changed the title fix(codex): single-flight prompt text probes to avoid concurrent subprocess floods [WRONG BRANCH] fix(codex): single-flight prompt text probes to avoid concurrent subprocess floods Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 28, 2026 04:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4559b28013

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +805 to +808
const probe = await Bun.file(new URL("../src/codex/prompt-text-probe.ts", import.meta.url)).text();
expect(probe).toContain("let activeProbe: Promise<PromptTextProbe> | null = null;");
expect(probe).toContain("if (activeProbe) return activeProbe;");
expect(probe).toContain("if (activeProbe === probe) activeProbe = null;");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Test the single-flight behavior, not source substrings

This test never invokes concurrent probes; it only searches the implementation text and does not even assert the crucial activeProbe = probe assignment. Removing that assignment would restore one subprocess per caller while every expectation here still passes, so the reported regression is not actually guarded. Add a controllable spawn/probe seam, start simultaneous calls, assert one underlying invocation, and verify that a new invocation is allowed after settlement.

AGENTS.md reference: AGENTS.md:L284-L286

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant