Repository navigation
fix(config): skip optional hardening for non-directory homes - #7688
Conversation
…tics A relative symlink target containing .. was normalized lexically, so a symlinked intermediate directory made the comparator follow the wrong parent. Walk each intermediate component within the existing read budget: resolve symlinked or missing directories with realpath, treat non-directories and failures as unknown, and keep the leaf for the next lstat hop.
Measured OS behavior splits by platform: Windows normalizes .. lexically across junctions/reparse points and even past missing components, while POSIX resolves each directory and refuses a missing crossing. Keep lexical resolve on Windows; on POSIX walk each intermediate component inside the read budget, record intermediate symlinks in the revalidation snapshot, and treat missing or non-directory crossings as unknown. Regressions assert the independent readFileSync/realpathSync result before the comparator verdict, and the POSIX-only literal-backslash case is an explicit platform skip.
A symlinked intermediate that resolves to a regular file must fail the traversal with ENOTDIR on POSIX; dirname() after realpath would have accepted the wrong catalog. Stat the resolved intermediate inside the read budget, require a directory, and record the resolved identity in the link snapshot so revalidation also catches a target swap.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Directory target validation src/config/paths.ts, structure/config.md, tests/windows/windows-config-read-acl-memo.test.ts |
Hardening skips paths that cannot be statted or do not resolve to directories. Documentation and tests cover regular files and directory symlinks or junctions. |
Fixture cleanup synchronization tests/codex-integration/codex-account-slot-identity.test.ts, tests/codex-integration/codex-auth-headless-accounts.test.ts |
Asynchronous teardown drains and removes fixture roots, restores environment values, and flushes config-hardening work for the fixture’s ocx directory. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- lidge-jun/opencodex#7777: Adds config-hardening settlement before Claude secret and settings writes.
- lidge-jun/opencodex#7528: Adds the fixture teardown helper used to settle ACL work before fixture removal.
- lidge-jun/opencodex#7551: Introduces the integration tests whose teardown hooks now flush config hardening.
Merge Risk: 
Minimal · up to faeea
-
The reviewed changes have no established merge-blocking risk.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "fix(config): skip optional hardening for non-directory homes" matches the main change. The change makes hardenConfigDir call statSync and return early when the resolved path is missing, errors on stat, or is not a directory, so optional chmod and ACL work is skipped. The PR objectives describe the same goal: OPENCODEX_HOME pointing to a regular file. The title is concise, names the type and scope, and does not list files. It is 60 characters, within a normal commit-title length.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
…10-dev50af-refresh-20261025
…88-refresh-parent-cf72-20261025
|
Maintainer decision for v2.93.0 release prep: DEFERRED_POST_RELEASE, together with its parent #7610. The same independent review (gpt-6.1-sol, high) covered this child at After the release, this can be retargeted once #7610 lands. Alternatively, the five child-specific files can be rebased directly onto |
…-20261023' into lb-7688
Retargeted to dev. The four conflicted files belong to lidge-jun#7610 and take dev's squashed version (9a61bd9); the five lidge-jun#7688 files are unchanged from the reviewed head d06cf9b apart from dev's own edits to structure/config.md.
# Conflicts: # structure/config.md
Maintainer integration decision: MERGE (squash) into devHead: faeead3. It merges current dev (4111e93, which includes #7777) into 51ab52c. dev has not moved since, so the merge result equals the tested head. Change. Optional config-directory hardening ( Review. Independent sol review r2 ( Combined-tree checks (pinned Bun 1.4.4): account-slot-identity, auth-headless-accounts, windows-config-read-acl-memo, the #7777 intercept ACL barrier, file-size ratchet and both layout guards: 100 pass, 1 skip (POSIX-only), 0 fail. Typecheck, structure SSOT, privacy scan and CI on the exact head faeead3:
NOT RUN: full suite locally, native macOS/Linux permission checks outside CI. |
Summary
When
OPENCODEX_HOMEpoints to a regular file, an account-store read can start optional directory hardening before a later profile check rejects the path. Check that the target is a directory before starting chmod or an ACL task. Keep directory symlinks/junctions supported, preserve the real-home guard, and leave required write-path validation unchanged.Drain the two account suites' configuration-hardening work before removing their fixtures, using the original fixture directory even when a case changes
OPENCODEX_HOME. Assertions, timeouts and the shared teardown helper's ordering remain unchanged.Head
d06cf9b3d5b55fc8dd024dc2854e5d0b778d2bd4normally merges the current #7610 parentcf72010f480d607bdf390717c28f62be240b0981into previous childa554968b. All five child-specific blobs are byte-identical to that child; the parent refresh does not change this guard or its callers. Retarget todevafter the parent lands.Verification
On this merged head, official Windows Bun 1.4.4, using the existing CI timeout contract:
codex-account-slot-identity,codex-auth-headless-accountsandwindows-config-read-acl-memo: 33 passed / 1 skipped / 0 failed. The inaccessible-default-home case explicitly excludes Windows; it is not counted as passing.The unchanged child at
a554968bpreviously passed full cross-platform run 40109666635, attempt 2: 28 successful jobs / 6 conditional skips. That is historical evidence fora554968b, not a new-head full run. Earlier cancellations/timeouts and the older macOS hardlink failure are retained separately; this guard is not claimed to explain or repair them. #7610 owns the related catalog path-identity change.Exact-head automatic CI 40227402907 passed. The regular-file guard does not solve concurrent path-replacement races or establish broad native permission guarantees. Merge order remains parent-first. No live runtime, account, certificate or GUI changed.
Checklist
Summary by CodeRabbit