mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-22 23:53:08 +00:00
feat: Add git log parsing and rebase endpoint with input validation
This commit is contained in:
@@ -63,6 +63,14 @@ export class WorktreeService {
|
||||
for (const relativePath of copyFiles) {
|
||||
// Security: prevent path traversal
|
||||
const normalized = path.normalize(relativePath);
|
||||
if (normalized === '' || normalized === '.') {
|
||||
const reason = 'Suspicious path rejected (empty or current-dir)';
|
||||
emitter.emit('worktree:copy-files:skipped', {
|
||||
path: relativePath,
|
||||
reason,
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (normalized.startsWith('..') || path.isAbsolute(normalized)) {
|
||||
const reason = 'Suspicious path rejected (traversal or absolute)';
|
||||
emitter.emit('worktree:copy-files:skipped', {
|
||||
|
||||
Reference in New Issue
Block a user