Conversation
mode bits before the umask and a permissive umask could leave them writable by other local users. When the token directory already exists, validate it rather than trusting it: reject symlinks and non-directories, group/other-writable dirs, and dirs not owned by the current user, closing a path-replacement vector on shared hosts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clusterURL.Path, which sanitizedURL then swaps into Host, bypassing the non-empty-path check. The unvalidated host was used directly as a filename in filepath.Join(f.dir, cluster), letting import/login/logout/export read, write, or delete files outside the token directory. Enforce containment at the store boundary: Load/Store/Delete now operate through an os.Root rooted at the token directory, so the OS rejects any "..", absolute path, or symlink escape. Add a tokenFileName guard that rejects keys that are not a single clean path element, giving a clear error at the CLI boundary. Legitimate hosts (with or without a port) are single path elements and pass through unchanged, so existing token files remain readable. Add regression tests covering the traversal vectors and filename validation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Tokenstorage
mode bits before the umask and a permissive umask could leave them
writable by other local users. When the token directory already exists,
validate it rather than trusting it: reject symlinks and non-directories,
group/other-writable dirs, and dirs not owned by the current user, closing
a path-replacement vector on shared hosts.
Path Traversal
clusterURL.Path, which sanitizedURL then swaps into Host, bypassing the
non-empty-path check. The unvalidated host was used directly as a filename in
filepath.Join(f.dir, cluster), letting import/login/logout/export read, write,
or delete files outside the token directory.
Enforce containment at the store boundary: Load/Store/Delete now operate through
an os.Root rooted at the token directory, so the OS rejects any "..", absolute
path, or symlink escape. Add a tokenFileName guard that rejects keys that are
not a single clean path element, giving a clear error at the CLI boundary.
Legitimate hosts (with or without a port) are single path elements and pass
through unchanged, so existing token files remain readable.
Add regression tests covering the traversal vectors and filename validation.