Repository navigation
fix(private-storage): throttle the ACL repair sweep on Windows - #333
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
`harden_private_tree` re-walked the whole session tree on every client start and spawned one `icacls` per entry; a few hundred sessions took ~24 s before the interactive client drew. Every path is already restricted when it is created, so the sweep is a repair, not the write path: it now runs at most once per week (a stamp inside the tree) and `force=True` still requests an immediate pass. Also bound the three `icacls` calls of one restriction with a shared 10 s budget, and stop paying that budget for 120 s after a spawn stalls — a degraded host keeps inherited ACLs (the documented fail-safe) instead of stalling every connect. Tests: the throttle skips a fresh stamp and `force` bypasses it; the existing ACL tests cover the fail-safe ordering.
Contributor
Author
|
@Zongwei9888 requesting security review for this change (ACL repair sweep throttling). Security Considerations are in the PR description; happy to adjust the interval, the force path, or the spawn-stall budget if you prefer different defaults. |
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.
Summary
harden_private_treere-walked the whole session tree on every client start and spawned oneicaclsper entry. On a mature tree that cost about 24 seconds before the interactive client could draw. Every path DeepCode creates is already restricted when it is created, so the sweep is a repair pass, not the write path.Two bounds:
force=Truestill requests an immediate repair.icaclscalls (grant, strip inheritance, remove broad principals) instead of up to 20 s each. After a spawn stalls, the code stops paying that budget for 120 s — a degraded host keeps inherited ACLs (the documented fail-safe) rather than stalling every connect.Changes
core/private_storage.py_ACL_SWEEP_STAMP_NAME,_ACL_SWEEP_INTERVAL_SECONDS;_acl_sweep_is_fresh()/_mark_acl_sweep().harden_private_tree(root, *, force=False)skips a fresh sweep and marks a completed one._run_icacls(..., abandon_after=None);_restrict_windows_aclshares a deadline across its three calls; a stalled spawn sets a 120 s cooldown.tests/test_private_storage_acl_once.py— the throttle test (Windows-only) and**_kwargsin the three existing stubs.Security Considerations
force=Trueis available to callers that need an immediate pass; a missing/corrupt stamp only means the next start sweeps again.Tests
tests/test_private_storage_acl_once.py— 9 passed on this revision (the throttle case is skipped off Windows);pre-commit(ruff 0.15.21 + ruff-format) clean.I could not add the
securitylabel or request a reviewer from a fork (no write access) — flagging here instead as the contributing guide asks, and requesting @Zongwei9888's security review in a comment.