fix(hub): contain index-sourced paths to project root (bd-rz6yb)#244
Merged
shikokuchuo merged 1 commit intoMay 31, 2026
Merged
Conversation
A malicious wire client could poison the index CRDT with a traversal, absolute, or symlink-escaping key and overwrite any file the server can write. Gate the single index-key -> fs-write site in sync_all_documents with a lexical contained_join plus a canonicalize/starts_with symlink-escape check; rejected entries are counted and warned.
af6c36f to
a20a02f
Compare
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
The Hub index is a client-writable CRDT mapping
path → doc, and the sync loop wrote each doc toproject_root.join(path)with no containment check (only an.exists()guard).Any authenticated client can put any key in the index over the wire, so a malicious one could set
../../../home/svc/.bashrcand have the server write attacker content outside the project root — an overwrite-any-writable-file primitive (potential RCE via shell rc / configs /.git/hooks)..exists()also follows symlinks, so a symlinked dir inside the root gave the same escape with no...Fix
sync_all_documentswith a lexicalcontained_join(rejects../absolute/rooted) plus acanonicalize+starts_withcheck (catches symlink escapes).@cscheid @gordonwoodhull this closes a security vulnerability whereby changes to an index document could result in filesystem changes on the server.