fix(cli): prevent tar path traversal in plugin install#1324
Open
kshirajahere wants to merge 1 commit intomofa-org:mainfrom
Open
fix(cli): prevent tar path traversal in plugin install#1324kshirajahere wants to merge 1 commit intomofa-org:mainfrom
kshirajahere wants to merge 1 commit intomofa-org:mainfrom
Conversation
Contributor
Author
|
@mugiwaraluffy56 please review :) |
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
Harden mofa plugin install tar extraction to prevent archive path traversal attempts from writing outside the plugin destination directory.
Related Issues
Closes #1323
Related to #461
Context
install_from_url() accepts remote .tar.gz archives and previously extracted them via tar::Archive::unpack(dest_dir). That broad extraction path does not provide explicit per-entry confinement logic in the installer and is risky in a supply-chain-sensitive code path.
This change applies explicit entry-level extraction checks so malicious archive entries cannot escape the plugin directory.
Changes
How you Tested
Screenshots / Logs (if applicable)
Key results:
Breaking Changes
Checklist
Code Quality
Testing
Documentation
PR Hygiene
Deployment Notes (if applicable)
No migration required.
Additional Notes for Reviewers
This PR intentionally limits scope to .tar.gz extraction hardening in CLI plugin install. Zip extraction already uses enclosed-name handling and is unchanged.