T09 · Insecure Skill Coding Practices
Warning
- Location
scripts/schema_builder.py:66- Finding
Unvalidated Schema Identifiers and DDL Fragments in Generated Cypher
- Content
View full analysis
NodeLabel: """Add a node label to schema.""" node = NodeLabel(label, description=description) self.nodes[label] = node return node def add_property_to_node(self, node_label: str, prop_name: str, prop_type: PropertyType = PropertyType.STRING, unique: bool = False, indexed: bool = False) -> None: """Add property to a node label.""" if node_label not in self.nodes: self.add_node(node_label) prop = Property(prop_name, prop_type, unique, indexed) self.nodes[node_label].add_property(prop) # Auto-create constraint for unique properties if unique: self.add_constraint(f"{node_label}.{prop_name} UNIQUE") # Auto-create index if indexed: self.add_index(f"ON (:{node_label})({prop_name})") def add_relationship(self, source: str, rel_type: str, target: str, properties: List[Property] = None) -> Relationship: """Add a relationship type to schema.""" rel = Relationship(source, rel_type, target, properties or []) self.relationships.append(rel) return rel def add_constraint(self, constraint: str) -> None: """Add constraint to schema.""" self.constraints.append(f"CREATE CONSTRAINT ON {constraint} IF NOT EXISTS") def add_index(self, index: str) -> None: """Add index to schema.""" self.indexes.append(f"CREATE INDEX {index} IF NOT EXISTS") def get_cypher_nodes(self) -> str: """Generate Cypher CREATE NODE statements.""" output = [] for label, node in self.nodes.items(): output.append(f"\n-- {label}") if node.description: output.append(f"-- {node.description}") output.append(f"CREATE ...[truncated 3512 chars]- Remediation
View remediation
