fix: Unauthenticated commit API can create product markdown files#23
Open
jonathanchang31 wants to merge 1 commit into
Open
fix: Unauthenticated commit API can create product markdown files#23jonathanchang31 wants to merge 1 commit into
jonathanchang31 wants to merge 1 commit into
Conversation
Author
|
@aglover1221 Could you plz review my PR? Thanks! && I Love Product-data-extractor. |
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
Fixes path traversal in
POST /api/pipeline/extract-products-from-source/commit.The commit API previously accepted client-controlled
category,vendor,productLine,slug, andsourcePathvalues without enough validation. A crafted request could create product markdown files outsidePRODUCT_MCP_DATA_DIR.This patch adds shared path-safety validation so product skeleton writes and source-path resolution stay inside the configured data root.
Related Issue
Fixed: #22
Change Type
Real Behavior Proof
Before Fix
A crafted request could create a file outside
PRODUCT_MCP_DATA_DIR:Observed before fix:
After Fix
The same request is rejected:
The escaped file is not created:
Validation Performed
Result:
npm testResult:
Result:
Result:
Runtime route checks:
Exploit regression check:
Security Impact
This closes an arbitrary file creation primitive where a caller could write product markdown files outside the configured data directory.
The fix prevents:
sourcePathresolutionChecklist