fix(tools): exec guard must not treat relative paths as root-absolute#2750
Open
Chris-dash-T4 wants to merge 1 commit intosipeed:mainfrom
Open
fix(tools): exec guard must not treat relative paths as root-absolute#2750Chris-dash-T4 wants to merge 1 commit intosipeed:mainfrom
Chris-dash-T4 wants to merge 1 commit intosipeed:mainfrom
Conversation
The path scanner used /[^\s"']+ anywhere in the command string, so archive/SKILL.md matched /SKILL.md, Abs resolved it to the filesystem root, and Rel produced .. chains that tripped the workspace check. Require Unix-looking absolutes to follow a shell delimiter (including / so file:/// paths still match). Parse with FindAllStringSubmatchIndex. Extend web URL exemption: after adding / as a delimiter, https://host can match /host with a single leading slash; detect via scheme suffix on the trimmed prefix before the match. Add TestShellTool_RelativePathWithSlashNotTreatedAsAbsolute. Made-with: Cursor
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
The path scanner used
/[^\s"']+anywhere in the command string, soarchive/SKILL.mdmatched/SKILL.md, Abs resolved it to the filesystem root, and Rel produced..chains that tripped the workspace check.Require Unix-looking absolutes to follow a shell delimiter (including
/sofile:///paths still match). Parse with FindAllStringSubmatchIndex.Extend web URL exemption: after adding
/as a delimiter,https://hostcan match/hostwith a single leading slash; detect via scheme suffix on the trimmed prefix before the match.Add
TestShellTool_RelativePathWithSlashNotTreatedAsAbsolute.Made-with: Cursor
🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Fixes #2749
📚 Technical Context (Skip for Docs)
/pathwould only be matched at the beginning of the line or after a whitespace-like delimiter. Thus,wc /path/to/filewill match, whilewc path/to/filewill pass through.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
As of

a94ba82, before fix:After fix:

☑️ Checklist
make lintidentified issues outside of the scope of this PR, mainly inpkg/configandweb/