Skip to content

Harden js_repl emitImage to accept only data: URLs#13507

Merged
fjord-oai merged 2 commits intomainfrom
codex/fix-js_repl-emitimage-url-validation-issue
Mar 5, 2026
Merged

Harden js_repl emitImage to accept only data: URLs#13507
fjord-oai merged 2 commits intomainfrom
codex/fix-js_repl-emitimage-url-validation-issue

Conversation

@fjord-oai
Copy link
Copy Markdown
Contributor

Motivation

  • Prevent untrusted js_repl code from supplying arbitrary external URLs that the host would forward into model input and cause external fetches / data exfiltration. This change narrows the emitImage contract to safe, self-contained data URLs.

Description

  • Kernel: added normalizeEmitImageUrl and enforce that string-valued codex.emitImage(...) inputs and input_image/content-item paths only accept non-empty data: URLs; byte-based paths still produce data URLs as before (kernel.js).
  • Host: added validate_emitted_image_url and check EmitImage requests before creating FunctionCallOutputContentItem::InputImage, returning an error to the kernel if the URL is not a data: URL (mod.rs).
  • Tests/docs: added a runtime test js_repl_emit_image_rejects_non_data_url to assert rejection of non-data URLs and updated user-facing docs/instruction text to state data URL support instead of generic direct image URLs (mod.rs, docs/js_repl.md, project_doc.rs).

Testing

  • Ran just fmt in codex-rs; it completed successfully.
  • Added a runtime test (cargo test -p codex-core js_repl_emit_image_rejects_non_data_url) but executing the test in this environment failed due to a missing system dependency required by codex-linux-sandbox (the vendored bubblewrap build requires libcap.pc via pkg-config), so the test could not be run here.
  • Attempted a focused cargo test invocation with and without default features; both compile/test attempts were blocked by the same missing system libcap dependency in this environment.

Codex Task

@fjord-oai fjord-oai added codex Label used by connector to tag PRs that have been reviewed by Codex aardvark labels Mar 4, 2026 — with ChatGPT Codex Connector
@fjord-oai fjord-oai marked this pull request as ready for review March 4, 2026 22:17
@fjord-oai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

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

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: 2e69ea53d0

ℹ️ 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".

@fjord-oai
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Swish!

ℹ️ 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".

@fjord-oai fjord-oai force-pushed the codex/fix-js_repl-emitimage-url-validation-issue branch 2 times, most recently from 1148169 to 418ea45 Compare March 5, 2026 18:42
@fjord-oai fjord-oai force-pushed the codex/fix-js_repl-emitimage-url-validation-issue branch from 418ea45 to c22c1c0 Compare March 5, 2026 19:11
@fjord-oai fjord-oai merged commit cfbbbb1 into main Mar 5, 2026
71 of 75 checks passed
@fjord-oai fjord-oai deleted the codex/fix-js_repl-emitimage-url-validation-issue branch March 5, 2026 20:12
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

codex Label used by connector to tag PRs that have been reviewed by Codex

2 participants