Skip to content

[WRONG BRANCH] fix(service): stop trusting PATH launchers in systemd units - #391

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-systemd-executable-vulnerability
Draft

[WRONG BRANCH] fix(service): stop trusting PATH launchers in systemd units#391
luvs01 wants to merge 1 commit into
mainfrom
codex/propose-fix-for-systemd-executable-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent a local lower-integrity PATH entry from being resolved at ocx service install and becoming the persistent systemd ExecStart target that receives service credentials.
  • Restore the previous trust anchor: the Bun runtime and CLI paths derived from the installed package, not an arbitrary absolute ocx found on PATH.

Description

  • Remove PATH-based launcher discovery and the launcher branch from systemd installs so units run the package-derived Bun + CLI pair (cliEntry()), not a PATH-selected ocx shim. This eliminates the executable-substitution attack surface in installSystemd() and buildUnit().
  • Remove the launcher-specific install state and related staleness checks; staleness diagnostics now validate the baked bunPath/cliPath provenance instead of an untrusted launcherPath.
  • Inline the service command to always use buildServiceShellCommand(bun, cli) for systemd units and drop the buildServiceLauncherShellCommand path.
  • Update tests to assert a unit is not generated from a PATH-resolved ocx and to reflect the package-derived shape (tests/service.test.ts).
  • Update documentation to explain that Linux systemd units bake the package-selected Bun+CLI and to recommend ocx service repair after version-manager upgrades (docs-site/src/content/docs/reference/cli/lifecycle.md).

Testing

  • Ran focused checks: bun run typecheck succeeded and bun run privacy:scan succeeded.
  • Ran the targeted service tests: npx --yes bun@latest test tests/service.test.ts — the focused service tests passed for the added regression (security regression covered); an unrelated container-only systemd diagnostic failure was documented.
  • Ran the full test suite in this constrained environment: it completed but reported environmental/timing failures unrelated to this change; the focused security regression is verified green.

Codex Task

@coderabbitai

coderabbitai Bot commented Aug 31, 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: 1156439b-aee9-40b6-a1ea-df51348a0d60


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 commented Aug 31, 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-08-31T01:03:30.616030Z 41eb29e 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.

@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: 41eb29ee56

ℹ️ 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 thread src/service.ts
if (typeof state.codexHome !== "string" || state.codexHome.length === 0) return null;
if (typeof state.opencodexHome !== "string" || state.opencodexHome.length === 0) return null;
for (const key of ["bunPath", "cliPath", "launcherPath", "winswVersion", "winswSha256"] as const) {
for (const key of ["bunPath", "cliPath", "winswVersion", "winswSha256"] as const) {

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 Mark legacy launcher units stale until repaired

When upgrading an installation whose existing v2 state contains launcherPath, this parser now silently accepts but discards that marker. If the recorded Bun and CLI paths still exist—such as an in-place npm upgrade—bakedServicePathsDiagnostic() returns healthy and diagnoseService() reports the service viable even though systemd's already-loaded unit still executes the PATH-selected launcher this security fix is intended to distrust. Treat any legacy launcherPath state/unit as stale and require or perform a repair before reporting it viable.

AGENTS.md reference: AGENTS.md:L326-L332

Useful? React with 👍 / 👎.

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

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot changed the title fix(service): stop trusting PATH launchers in systemd units [WRONG BRANCH] fix(service): stop trusting PATH launchers in systemd units Aug 31, 2026
@github-actions

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 is being kept as a draft automatically. Once every issue above is resolved, it will be marked ready for review again.

@github-actions
github-actions Bot marked this pull request as draft August 31, 2026 01:18
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