Skip to content

fix(runtime): pin codex setup to rust-v0.118.0 for security#663

Merged
sergio-sisternes-epam merged 2 commits intomicrosoft:mainfrom
sergio-sisternes-epam:fix/662-codex-pin-version
Apr 10, 2026
Merged

fix(runtime): pin codex setup to rust-v0.118.0 for security#663
sergio-sisternes-epam merged 2 commits intomicrosoft:mainfrom
sergio-sisternes-epam:fix/662-codex-pin-version

Conversation

@sergio-sisternes-epam
Copy link
Copy Markdown
Collaborator

Summary

Pin codex runtime setup scripts to rust-v0.118.0 instead of "latest" to prevent supply-chain attacks and ensure reproducible installs. Also updates the generated config from wire_api = "chat" to wire_api = "responses" — the only protocol supported by current Codex releases.

Closes #662

Problem

Using CODEX_VERSION="latest" means APM downloads whichever codex binary happens to be the newest release. This is a supply-chain risk — a compromised upstream release would be automatically pulled by every apm runtime setup codex invocation.

Additionally, the generated Codex config used wire_api = "chat", which has been removed from the Codex config schema entirely. All current releases only support wire_api = "responses".

Changes

  • scripts/runtime/setup-codex.sh: Pin CODEX_VERSION="rust-v0.118.0", update wire_api to "responses", add pin rationale messaging
  • scripts/runtime/setup-codex.ps1: Same changes for Windows
  • CHANGELOG.md: Add entry under Fixed

Context

Discovered during CI investigation of PR #651 — an earlier attempt to pin to 0.1.2025051600 (a deleted tag) caused integration test failures. See root cause analysis.

Testing

  • Verified rust-v0.118.0 assets exist and are downloadable (HTTP 302) for all platforms
  • Archive structure (codex-{platform} binary inside tar.gz) is compatible with existing extraction logic
  • Users can still override with apm runtime setup codex latest or any specific version

…t#662)

- Pin CODEX_VERSION to rust-v0.118.0 (latest stable) instead of 'latest'
  to prevent supply-chain attacks via compromised upstream releases
- Update wire_api from 'chat' to 'responses' (the only protocol
  supported by current Codex releases)
- Add user-facing messages about the pin and how to override
- Apply same changes to both .sh (Linux/macOS) and .ps1 (Windows)

Closes microsoft#662

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 10, 2026 10:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Pins the Codex runtime setup scripts to a specific upstream Codex release to improve supply-chain safety and install reproducibility, and updates the generated Codex config to the current wire_api protocol expected by modern Codex releases.

Changes:

  • Pin default Codex version from latest to rust-v0.118.0 in both Unix and Windows setup scripts.
  • Update generated Codex config from wire_api = "chat" to wire_api = "responses".
  • Add a changelog entry under Unreleased -> Fixed.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
scripts/runtime/setup-codex.sh Pins default Codex version and updates generated config wire_api. Adds user-facing pin/override messaging.
scripts/runtime/setup-codex.ps1 Same as above for PowerShell/Windows; includes user-facing messaging.
CHANGELOG.md Records the change under Fixed in Unreleased.

- Use correct CLI syntax: apm runtime setup codex --version <version>
- Replace 'pinned to' wording with neutral 'Using Codex $VERSION'
- Fix CHANGELOG entry to reference PR microsoft#663 instead of issue microsoft#662
- Update runtime-compatibility.md to reflect pinned default version

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergio-sisternes-epam sergio-sisternes-epam merged commit edad526 into microsoft:main Apr 10, 2026
20 checks passed
@sergio-sisternes-epam sergio-sisternes-epam deleted the fix/662-codex-pin-version branch April 10, 2026 16:33
edenfunf added a commit to edenfunf/apm that referenced this pull request Apr 10, 2026
- Fix 1: include .cmd and .bat in Windows APM runtimes dir lookup so
  llm.cmd (installed by setup-llm.ps1) is found when ~/.apm/runtimes
  is not in PATH
- Fix 2: rebase already picked up rust-v0.118.0 pin from origin/main
  (microsoft#663); resolve the setup-codex conflicts in favour of main
- Fix 3: add ensure_path_within() checks in _discover_prompt_file and
  _resolve_prompt_file (PromptCompiler) to catch symlinks that resolve
  outside the project directory; also filter unsafe dependency matches
  from rglob results rather than silently including them
- Fix runtime mis-detection: reorder _transform_runtime_command to
  check copilot before codex, preventing "copilot --model codex ..."
  from being routed to the codex path; replace substring match in
  _detect_runtime with Path.stem comparison so hyphenated tool names
  (run-codex-tool) are not mistakenly identified as a known runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pin codex setup to a known release for security and reproducibility

3 participants