Repository navigation
Conversation
Private effect snapshot admission rejected symlinks but still treated a hard link as an exclusive regular file. A same-uid hard link from a loopx-effect-* sink to a file outside that directory was readable and writable, so the response write truncated the external inode. Admit a private snapshot leaf only when it is an exclusive regular file (nlink === 1 / st_nlink == 1). Directories keep their ordinary link count. A hard-linked leaf fails closed and is not truncated or repaired. Signed-off-by: Duang777 <[email protected]>
Duang777
requested review from
JasonBuildAI,
huangruiteng,
loopx-agent and
songoow
as code owners
November 28, 2026 02:47
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal And Delivered Outcome
Private Effect snapshot and response-sink admission treated a hard link as an ordinary private file. Symlink checks do not cover that alias:
lstatreports a hard link as a regular file,O_NOFOLLOWdoes not refuse it, and the same uid/mode/inode checks still pass. A pre-existing sink path insideloopx-effect-*that is a hard link to a same-uid file outside that directory was admitted.writePrivateResponsethen truncated that external inode.main. No tracker issue.main,readPrivateJsonSnapshotreturned the hard-linked JSON, andopenPrivateResponseSink+writePrivateResponsereplaced the external sentinel with{"clobber":true}.require_private_pathand_read_local_snapshot_responsealso accepted the link. After this change those calls fail closed, and the sentinel bytes stay unchanged.mainat811c1a1f66652d3fc3b9830d467e14b45b7423c1.Author Declaration
Implemented against
isFile()andnlink === 1; opened fd stillnlink === 1)privateFileinloopx/control_plane/effect_runtime_snapshot.tsnode --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/effect_runtime_snapshot.test.tsS_ISREGandst_nlink == 1, including the opened fd; directories keep ordinary directory link countsrequire_private_pathinloopx/control_plane/runtime/private_permissions.pyuv run --extra test python -m pytest tests/control_plane/test_private_snapshot_exclusive_file.py -qOSErrorEPERM/ENOTSUP/EOPNOTSUPP/EXDEV/ENOSYSmain, then re-ran the same tests after the admission change. Also ran the existing snapshot integration cases, the Windows privacy file (skipped on this host), scoped ruff, andnpm run typecheck:control-plane. Did not audit unrelated hard-link sites.Scope And Continuation
truncateis still a narrow time-of-check window; this PR closes the pre-existing alias that admission used to accept.Validation
02dcffae4ca9e22f48b3ca3010bcf50dc9e909a1regression_parityfailednode --no-warnings --experimental-sqlite --experimental-strip-types --test tests/control_plane_ts/effect_runtime_snapshot.test.ts: 4 tests, 2 pass, 2 fail. The read test received the hard-linked object. The sink test replaced the external sentinel with{"clobber":true}.uv run --extra test python -m pytest tests/control_plane/test_private_snapshot_exclusive_file.py -q: 2 failed, 2 passed.require_private_pathdid not raise;_read_local_snapshot_responsedid not raiseEffectRuntimeResponseAmbiguous.unitpassedunitpasseduv run --extra test python -m pytest tests/control_plane/test_windows_snapshot_privacy.py -q: 18 skipped on this non-Windows host.integrationpasseduv run --extra test python -m pytest tests/control_plane/test_effect_runtime_integration.py::test_large_local_response_digest_failure_is_ambiguous tests/control_plane/test_effect_runtime_integration.py::test_controller_snapshot_retains_private_file_and_method_guards -q: 2 passed.staticpasseduv run --extra test python -m ruff check loopx/control_plane/runtime/private_permissions.py tests/control_plane/test_private_snapshot_exclusive_file.py: all checks passed.npm run typecheck:control-plane: exit 0.scripts/check_rfc_bilingual.py --base origin/main --staged: passed (no paired RFC).See validation disclosure guidance.
Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).