Skip to content

security(update-markdown-uml): symlink traversal in discoverLeafComponents — no isSymbolicLink() guard #48

Description

@datalackey

Finding

discoverLeafComponents recurses into directories without checking whether entries are symbolic links. A directory tree containing a symlink cycle causes infinite recursion and a stack overflow.

Location

src/analysis/discoverLeafComponents.ts — the recursive walker calls itself on dirent.isDirectory() but has no dirent.isSymbolicLink() guard or depth limit.

Impact

  • A project with a symlink loop (e.g. node_modules/.bin on some platforms, or a manually crafted fixture) causes the process to crash.
  • Reachable through autogen-markdown-doc's orchestration layer.

Fix

Add a symlink guard before recursing:

if (dirent.isSymbolicLink()) continue;

Optionally also add a maxDepth parameter defaulting to a safe value (e.g. 20).

Severity

🟠 Security / correctness (potential DoS via crafted input)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions