Skip to content

Commit 3316cc3

Browse files
committed
fix: skip symlinks during docs snapshot sync
Block symlink traversal in syncDocsSnapshot to prevent copying files outside the docs root. Checks d.Type()&fs.ModeSymlink before copy.
1 parent 4733c79 commit 3316cc3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

hack/gen-coder-docs-skill/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ func syncDocsSnapshot(sourceRoot, destRoot string) error {
174174
if d.IsDir() {
175175
return nil
176176
}
177+
178+
// Block symlink traversal: a symlinked .md/.json could point outside the docs
179+
// root, so we skip any entry that is not a regular file.
180+
if d.Type()&fs.ModeSymlink != 0 {
181+
return nil
182+
}
183+
177184
if !shouldCopyFile(currentPath) {
178185
return nil
179186
}

0 commit comments

Comments
 (0)