Skip to content

Preserve local environments during concurrent setup - #21

Merged
agammann merged 1 commit into
mainfrom
fix/exclusive-local-env
Oct 20, 2026
Merged

agammann merged 1 commit into
mainfrom
fix/exclusive-local-env

Conversation

@agammann

@agammann agammann commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Local setup checked for .env and then opened that pathname for truncating writes, so another setup could create an environment in between and have it overwritten. Create the file exclusively and write through the owned descriptor. Existing entries, including dangling links, are preserved without reading the template; write failures never unlink a shared pathname.

Prepare source version 1.0.1, keeping the package, MCP, container references and source-download instructions consistent. Add regressions for a competing writer, concurrent creators, existing entries, missing templates and failed-write cleanup.

Validation: the exact-head PR workflow passed verification with disposable PostgreSQL and browser checks, recovery and source packaging. Local Windows lint/typecheck, both build paths and fresh extracted-source checks also passed; the archive matched all 129 tracked blobs. The controlled subprocess race overwrites a competing environment on the earlier source and preserves it after this change. The Windows host skips file-symlink creation because it lacks that privilege; Linux CI exercises that test.

The aggregated CodeQL check still reports two potential filesystem-race warnings, so the overall check set is not entirely green. One points to scripts/setup-env.mjs:24: the early lstat preserves existing-entry behavior, while openSync('.env', 'wx', 0o600) is the actual exclusive creation boundary and returns EEXIST without overwriting a competing file. The query matches check/use order but does not examine exclusive-open flags. The second points to tests/setup-env.test.ts:90, which intentionally creates a fresh fixture target after asserting its absence to test linked and dangling entries. The tested atomic controls and isolated fixture context do not establish a surviving attacker-controlled overwrite. The annotations remain visible; no query gate or alert state was changed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 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-10-20T04:29:11.029562Z 7b9be1b 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.

Comment thread scripts/setup-env.mjs Dismissed
Comment thread tests/setup-env.test.ts Dismissed
@agammann
agammann merged commit 67d7891 into main Oct 20, 2026
6 of 7 checks passed
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.

2 participants