Repository navigation
Fix quarantine layout symlink escapes - #47
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Andre Schu <[email protected]>
1 of 3 tasks
Owner
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.
Bug and impact
A recent quarantine layout change trusted
$SCP_QUARANTINE_DIR/registry_fetchwithPath.is_dir(), which follows symlinks. If that layout path was a symlink, registry-fetch quarantine writes, list/purge, quota eviction, and the registry merge gate could operate on files outside the real quarantine layout boundary. Concrete impacts included outside-root writes/deletes and forged root-layout quarantine files becoming merge-eligible whenregistry_fetchpointed back at the quarantine root.Root cause
Allowlisted layout directories were added to trusted quarantine scopes without rejecting symlinks or verifying that the real directory is strictly below the resolved quarantine root. The merge gate also resolved
registry_fetchdirectly, so a symlinked layout could collapse the trusted fetch root to the quarantine root.Fix
quarantine_limits.safe_layout_subdir()/ensure_layout_subdir()helpers that accept only real, non-symlink layout directories strictly under the resolved root.registry_ssot.apply_merge()path gating.registry_fetch -> quarantine root.Validation
PYTHONPATH=src python3 -m pytest tests/test_security_regressions.py::test_symlinked_registry_fetch_layout_is_not_listed_or_purged_outside_root tests/test_security_regressions.py::test_registry_fetch_quarantine_rejects_symlinked_layout_dir tests/test_registry_ssot.py::test_apply_merge_rejects_registry_fetch_symlink_to_quarantine_root -q-> 3 passed.PYTHONPATH=src python3 -m pytest tests/test_security_regressions.py tests/test_registry_ssot.py tests/test_registry_fetch_r4.py tests/test_registry_load_order_r5.py -q-> 54 passed.PYTHONPATH=src python3 -m compileall -q src/scp && git diff --check-> passed.pytest,mcp>=1.2.0,<2.0.0,coincurve,websocket-client) reached 357 passed / 3 skipped / 3 failed. Remaining failures appear pre-existing: vendoredscp_mcp_v1andscp_mcp_v1.1contract hash mismatches, plustest_rt11_authority_only_is_reversal.