Skip to content

fix: add path traversal guard in sync_marketplace_to_plugins.py - #170

Closed
xiaolai wants to merge 2 commits into
fcakyon:mainfrom
xiaolai:fix/nlpm-path-traversal-guard
Closed

fix: add path traversal guard in sync_marketplace_to_plugins.py#170
xiaolai wants to merge 2 commits into
fcakyon:mainfrom
xiaolai:fix/nlpm-path-traversal-guard

Conversation

@xiaolai

@xiaolai xiaolai commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Automated audit: This PR was generated by NLPM, a natural language programming linter, running via claude-code-action. Please evaluate the diff on its merits.

The sync_marketplace_to_plugins.py hook script resolves the source field from marketplace.json into a file path but does not verify that the resolved path stays within the expected plugin root. A tampered marketplace.json could write files outside the repository. This PR adds a guard that skips any entry whose resolved path escapes the marketplace root.

  • Added a check after plugin_dir = (marketplace_dir / source).resolve() that compares the resolved path against the marketplace root
  • If the resolved path escapes the root, the entry is skipped with a warning to stderr and the loop continues

Co-Authored-By: Claude Code <noreply@anthropic.com>
@fcakyon

fcakyon commented Jul 24, 2026

Copy link
Copy Markdown
Owner

the check just compares text, so a folder named claude-settings-evil slips straight past it, and anyone who could edit marketplace.json could already write files anyway

@fcakyon fcakyon closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants