T09 · Insecure Skill Coding Practices
- Location
scripts/graph_path_analyzer.py:219- Finding
Unbounded Graph Path Enumeration Can Cause Denial of Service
- Content
View full analysis
List[GraphPath]: """ Find all paths between source and target. Args: source: Starting node target: Destination node max_paths: Maximum paths to return Returns: List of GraphPath objects """ paths = [] visited = set() def dfs(current, target_node, path, edges): if current == target_node: paths.append(GraphPath( nodes=path[:], confidence=self._calculate_confidence(path), edges=edges[:] )) return if len(path) - 1 >= self.config.max_path_length: return if max_paths and len(paths) >= max_paths: return for neighbor in self.edges.get(current, {}): if neighbor not in path: # Avoid cycles edge_data = self.edges[current][neighbor][0] # Check filters if not self._passes_filters(edge_data): continue path.append(neighbor) edge_obj = PathEdge( source=current, target=neighbor, relation_type=edge_data.get('type', 'connected_to'), confidence=edge_data.get('confidence', 0.5) ) edges.append(edge_obj) dfs(neighbor, target_node, path, edges) path.pop() edges.pop() dfs(source, target, [source], [] ...[truncated 3345 chars]- Remediation
View remediation
= effective_limit: return True if current == target_no ...[truncated 1025 chars]
