Skip to content

fix(ai): polyglot tree-sitter file size boundary guard and resource containment #119

Closed

Description

@dan-petty

Problem Statement

DevSecOps review revealed that while the Python AST parser enforces MAX_REPOMAP_FILE_SIZE_BYTES (5MB), _polyglot_to_file_node in devops_cli.ai.repomap parses arbitrary-sized polyglot files (TypeScript, Go, Rust, Java, HCL) without checking file size, allowing massive files, minified bundles, or generated database dumps to cause memory spikes or OOM crashes.

Proposed Changes

  • Enforce mandatory pre-flight MAX_REPOMAP_FILE_SIZE_BYTES checks in _polyglot_to_file_node.
  • Verify symlink target subpath containment to prevent circular link traversal.
  • Emit structured warning log when skipping oversized polyglot files.

Acceptance Criteria

  • Immediate exclusion of polyglot files exceeding 5MB or circular symlinks.
  • 100% test coverage for polyglot size boundaries in tests/test_repomap.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/aitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions