-
Notifications
You must be signed in to change notification settings - Fork 32
fix(security,resilience): pre-release hardening from deep stress test #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bca3aad
fix(security,resilience): pre-release hardening from deep stress test
ndycode f7e19fe
chore(release): cut v2.1.13-beta.3 + bump vitest to ^4.1.8
ndycode 4f0eefc
fix: address #503 review (dir-mode + retry/strip coverage + version p…
ndycode 3dcc500
fix: address #503 round-2 review (chmod error handling + win32/strip …
ndycode 638a207
test(observability): assert snapshot temp file is written 0o600
ndycode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # v2.1.13-beta.3 | ||
|
|
||
| Beta prerelease that lands the Phase 1 correctness/security audit (#499), the new | ||
| `mcodex` launcher + cached statusline (#500), and a round of pre-release | ||
| hardening surfaced by a whole-tree stress test (#503). It carries forward the | ||
| cascade OAuth token-invalidation fix from v2.1.13-beta.2, the multi-workspace | ||
| support from v2.1.13-beta.1, and the pinned-account 503 diagnostic from | ||
| v2.1.13-beta.0. | ||
|
|
||
| This is a **prerelease**. Stable `v2.1.13` will land once the issue #486 root | ||
| cause is identified and patched. | ||
|
|
||
| ## Install | ||
|
|
||
| ```bash | ||
| npm i -g codex-multi-auth@beta | ||
| ``` | ||
|
|
||
| ## mcodex launcher (#500) | ||
|
|
||
| A lightweight launcher and cached multi-auth status display for Codex sessions. | ||
|
|
||
| - `mcodex` — launch Codex with a cached status line printed before startup | ||
| (model, reasoning effort, cwd, active account, quota usage, plan, cache age). | ||
| - `mcodex --tmux` — launch inside a tmux session with mouse scrollback. | ||
| - `mcodex --tmux --live-accounts` — add a live `codex-multi-auth list` monitor pane. | ||
| - `mcodex --monitor` — monitor-only mode. | ||
|
|
||
| ### Status line | ||
|
|
||
| - Reads local `quota-cache.json`, `runtime-observability.json`, and account | ||
| storage; never calls OpenAI on launch. | ||
| - Refreshes quota data in the background only when the cache is stale (default | ||
| 10 min, `CODEX_MULTI_AUTH_STATUS_QUOTA_REFRESH_INTERVAL_MS`), behind a lock so | ||
| concurrent launches don't double-refresh. Stale refresh locks recover after | ||
| 10 min. | ||
| - Resolves the **per-project** account pool when `perProjectAccounts` is enabled | ||
| and Codex CLI sync is off (mirrors the runtime's own account scoping), falling | ||
| back to the global pool otherwise. Quota/observability stay global. | ||
| - Toggle with `CODEX_MULTI_AUTH_STATUSLINE=0`. | ||
|
|
||
| ### Hardening | ||
|
|
||
| - `MCODEX_MONITOR_INTERVAL` / `MCODEX_TMUX_HISTORY_LIMIT` are validated as numeric | ||
| before being interpolated into `watch` / tmux commands (no shell injection). | ||
| - `--monitor` / `--live-accounts` fail fast with a clear message when `watch` | ||
| isn't installed instead of spawning a broken pane. | ||
| - The status path resolves `~` correctly on Windows (`path.sep`, not a hardcoded | ||
| `/`), and reads the account pool without blocking the event loop. | ||
|
|
||
| ## Phase 1 audit remediation (#499) | ||
|
|
||
| Security and correctness hardening across the runtime, storage, and prompt layers. | ||
|
|
||
| ### Security | ||
|
|
||
| - **Prompt cache integrity.** Cached Codex instructions are SHA-256 verified; a | ||
| tampered cache is discarded, and a legacy entry with no recorded digest is | ||
| treated as unverified — it is never fast-path served and never drives a | ||
| conditional `304` revalidation (which could otherwise launder un-vetted bytes). | ||
| A full fetch mints the first digest; old bytes are kept only as an offline | ||
| fallback. | ||
| - **Path-traversal defense in recovery.** Stored message/part records are | ||
| validated before their ids are used to build filesystem paths; a | ||
| parseable-but-unsafe id (e.g. `../poison`) or a non-numeric `time.created` is | ||
| quarantined instead of escaping into a traversal read or a `NaN` sort. | ||
| - **Loopback-only egress.** The runtime rotation proxy and local bridge bind | ||
| loopback-only with no opt-out, and never forward inbound client credentials | ||
| (`authorization`, `x-api-key`, `cookie`, `proxy-authorization`) upstream | ||
| alongside the managed token. IPv6 loopback (`::1` / `[::1]`) is normalized | ||
| consistently for both the socket bind and the emitted base URL. | ||
| - **Token/email redaction.** Log, debug-bundle, and status sinks mask tokens and | ||
| emails; the debug bundle redacts the home prefix (case- and | ||
| separator-insensitive on Windows), strips credentials from config values, and | ||
| masks the account id. | ||
|
|
||
| ### Correctness & resilience | ||
|
|
||
| - **No event-loop blocking.** Removed synchronous `Atomics.wait` sleeps from the | ||
| config load path and the logger's directory-creation retry; both now retry | ||
| without freezing the event loop. | ||
| - **Bounded network reads.** Prompt and release-metadata fetches are bounded by | ||
| connect+body timeouts that actually cancel a stalled body. | ||
| - **Windows filesystem resilience.** Account-store WAL/temp writes, temp cleanup, | ||
| backup copy/rename, quota-cache, flagged-store, and export operations retry the | ||
| shared transient-lock taxonomy (EBUSY/EPERM/ENOTEMPTY/EACCES/EAGAIN) so an | ||
| antivirus/indexer/concurrent-reader lock doesn't fail a valid operation or | ||
| strand a secret-bearing temp file. | ||
| - **Atomic, self-healing account store.** Writes go through a checksummed WAL + | ||
| temp-and-rename; a torn write self-heals on the next read. | ||
|
|
||
| ### CLI | ||
|
|
||
| - `codex-multi-auth status` / `list` gained `--json` for machine-readable output, | ||
| with a stable shape whether or not accounts are configured. | ||
|
|
||
| ## Pre-release hardening (#503) | ||
|
|
||
| - Strip inbound `cookie` / `proxy-authorization` on both egress paths. | ||
| - Bound the proxy's upstream error-body read (previously unbounded on 4xx/5xx). | ||
| - Persist `runtime-observability.json` owner-only (`0o600` / dir `0o700`) on POSIX. | ||
| - Bump `vitest` to `^4.1.8` (dev-only) to clear GHSA-5xrq-8626-4rwp. | ||
|
|
||
| ## Verification | ||
|
|
||
| Full test suite (4,200+ tests) green; `npm run audit:ci` clean; typecheck and | ||
| lint pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.