[rajashidattapy] fix: apply os.sep boundary to serve/seed path guards (#136)#139
Open
rajarshidattapy wants to merge 1 commit into
Conversation
…openswarm-ai#136) serve_workspace_file and the workspace seed writer checked containment with a bare startswith(folder), so a sibling workspace whose id is a string prefix of the target (abc vs abc-evil) passed the guard. Match the stronger form already used by write_workspace_file/delete_workspace_file: startswith(folder_norm + os.sep) with the folder-itself equality escape. 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.
Description
Fixes #136.
serve_workspace_file()and the workspace seed writer validated workspace containment using a barestartswith(folder)comparison. As a result, a sibling workspace whose ID was a string prefix of the target workspace (e.g.abcvs.abc-evil) satisfied the containment check, leaving these two endpoints inconsistent with the stronger validation already implemented bywrite_workspace_file()anddelete_workspace_file().Changes
serve_workspace_file()and the workspace seed writer to use the same directory-boundary check already employed by the write/delete endpoints:abcmatchingabc-evil.Validation