fix(skills-hub): path traversal in remove() + add /skill remove Discord command#1
Merged
Merged
Conversation
…remove Discord command Co-authored-by: Rahul-2k4 <216878448+Rahul-2k4@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review pull request 75 for issue completion
fix(skills-hub): path traversal in Mar 10, 2026
remove() + add /skill remove Discord command
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
Two gaps in PR mofa-org#75's Skills Hub implementation: a path traversal vulnerability in
SkillHubClient::remove(), and the missing/skill removeDiscord slash command required by issue mofa-org#56's "Remove installed skills" user story.🔗 Related Issues
Related to mofa-org#56
🧠 Context
remove()joinedmanaged_rootwith an unvalidated name before callingfs::remove_dir_all(). A name like../important_dirwould silently delete directories outside~/.mofaclaw/skills/hub/. Bothinstall()andget_installed()already calledvalidate_skill_name()—remove()was the odd one out.Separately, the hub client's
remove()method was never surfaced as a Discord slash command, leaving the "Manage Installed Skills → Remove" user story from issue mofa-org#56 unfulfilled.🛠️ Changes
SkillHubClient::remove()— addvalidate_skill_name(name)?;guard before path join, consistent withinstall()andget_installed()/skill remove <name>Discord subcommand — member-role gated, mirrors/skill installpermission model; registered in theskillcommand groupremove_rejects_path_traversal_name,remove_returns_false_for_nonexistent_skill(unit);test_hub_client_remove_uninstalls_skill(integration)🧪 How you Tested
cargo test -p mofaclaw-core skills_hub— 11/11 pass (was 10)cargo test -p mofaclaw-core— 114/114 unit tests passcargo build -p mofaclaw-core— clean build📸 Screenshots / Logs (if applicable)
🧹 Checklist
Code Quality
cargo fmtruncargo clippy --workspace --all-featurespasses locallyTesting
cargo test --workspace --all-featurespasses locallycargo build --examples(if examples are present)Documentation
PR Hygiene
main🚀 Deployment Notes (if applicable)
No migrations or config changes required.
🧩 Additional Notes for Reviewers
The
validate_skill_namefix is a one-liner but high-impact — without it, any caller (Discord command, API, test) passing a crafted name could blow away arbitrary directories under the user's home. The pattern is already established byinstall()andget_installed();remove()was simply missed.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.