Skip to content

[WRONG BRANCH] fix(codex): refuse unsafe paginated provider transitions - #525

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-provider-table-transitions
Draft

luvs01 wants to merge 1 commit into
mainfrom
codex/fix-vulnerability-in-provider-table-transitions

Conversation

@luvs01

@luvs01 luvs01 commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent provider-table transitions from committing config that removes the root openai_base_url while leaving paginated threads tagged openai, which would let resumed conversations bypass the proxy and reach OpenAI directly. This preserves the routing invariant and prevents leakage of conversation context to the wrong provider.

Description

  • Distinguish paginated openai rows from opencodex rows in the history preflight by selecting model_provider in the query and returning a new refusal code history_paginated_openai_requires_native_writer when a provider-table transition encounters a paginated openai thread. (Change in src/codex/history-provider.ts.)
  • Add an integration test that simulates a provider-table (authless) transition with an existing paginated openai thread and asserts the injector refuses the transaction without changing config.toml or rollout bytes. (Change in tests/codex-integration/codex-inject-integration.test.ts.)
  • Update structure/config.md to document that the stand-down exception does not apply when paginated openai rows would be stranded, and that such transitions now refuse with history_paginated_openai_requires_native_writer. (Documentation update in structure/config.md.)

Testing

  • ✅ Ran the focused integration test: npx --yes bun@latest test tests/codex-integration/codex-inject-integration.test.ts and observed the new test passing along with the suite-specific cases (76 pass, 1 environment-dependent skip).
  • ✅ Typecheck with npx --yes bun@latest run typecheck succeeded.
  • ✅ Structure SSOT check with npx --yes bun@latest run structure:check succeeded.
  • ✅ Privacy scan with npx --yes bun@latest run privacy:scan succeeded.
  • ⚠️ Full npx --yes bun@latest run test was attempted but the container produced unrelated platform-specific failures (native-profile origin-status and Unix process-group/zombie cleanup assertions); the changed regression passed in focused runs.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T01:02:26.324433Z bc16074 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 14, 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: Advanced

Run ID: 3ae6dd66-76e2-4bed-b5f4-37fbb3f2a489


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.

@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: bc16074fe3

ℹ️ 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 +368 to +371
if (providerTableMode && row.model_provider === "openai") {
return "history_paginated_openai_requires_native_writer";
}
return "history_paginated_requires_native_writer";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scan all rows before accepting the paginated stand-down

When a provider-table transition encounters a mixed store where an opencodex row is returned before an openai row, this immediate return reports the permitted generic stand-down without ever inspecting the later openai thread. Because the query has no ordering guarantee, the transaction can then remove openai_base_url and cause that thread to resume through Codex's built-in OpenAI endpoint—the exact leak this change intends to prevent. Check for any selected openai row before returning the generic stand-down, or otherwise scan all rows first.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added the bug Something isn't working label Sep 14, 2026
@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot changed the title fix(codex): refuse unsafe paginated provider transitions [WRONG BRANCH] fix(codex): refuse unsafe paginated provider transitions Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 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 September 14, 2026 01:41
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