Skip to content

Cypher injection via unchecked max_hops in Neo4j KG backend #783

Closed

Description

@AmitoVrito

Location: src/synapsekit/retrieval/kg/backends.py:135

Problem: f"...RELATIONSHIP*1..{max_hops}..." interpolates max_hops directly (variable-length bounds can't be parameterized). It is annotated int but never enforced at runtime; a caller passing a crafted string from user-derived input yields arbitrary Cypher (e.g. DETACH DELETE). Same class as the property_graph fix already merged.

Fix: int(max_hops) cast + bounds check before interpolation.

Severity: Medium (security). Found in production-readiness audit.

Activity

  1. added
    bug
    security
    on Jul 14, 2026
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

    bugsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions