Skip to content

Security: Path traversal/arbitrary file write risk in parallel copy worker#468

Open
tuanaiseo wants to merge 1 commit into
the-open-engine:mainfrom
tuanaiseo:contribai/fix/security/path-traversal-arbitrary-file-write-risk
Open

Security: Path traversal/arbitrary file write risk in parallel copy worker#468
tuanaiseo wants to merge 1 commit into
the-open-engine:mainfrom
tuanaiseo:contribai/fix/security/path-traversal-arbitrary-file-write-risk

Conversation

@tuanaiseo

Copy link
Copy Markdown

Problem

Destination paths are created using path.join(destBase, relativePath) without validating that relativePath stays within destBase. If files contains ../ segments or absolute-like traversal payloads, writes can escape the intended directory and overwrite arbitrary files.

Severity: high
File: src/copy-worker.js

Solution

Normalize and validate each path before copy: resolve destination (path.resolve(destBase, relativePath)) and enforce it starts with path.resolve(destBase) + path.sep. Reject entries that fail this check.

Changes

  • src/copy-worker.js (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

…sk in parall

Destination paths are created using `path.join(destBase, relativePath)` without validating that `relativePath` stays within `destBase`. If `files` contains `../` segments or absolute-like traversal payloads, writes can escape the intended directory and overwrite arbitrary files.

Affected files: copy-worker.js

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
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.

1 participant