Find All Attack Paths in a Security Graph
Last updated: December 9, 2025
Quick Overview
Given a directed graph representing cloud resources and their relationships, find all paths from any internet-exposed resource to any resource containing sensitive data. Optimize for large graphs with millions of nodes.
Wiz
December 9, 202515
12
2,981 solved
Given a directed graph representing cloud resources and their relationships, find all paths from any internet-exposed resource to any resource containing sensitive data. Optimize for large graphs with millions of nodes.
Graph traversal problems are central to Wiz's interview because the Security Graph is their core product. This problem mirrors the real challenge of identifying attack paths: given a graph of cloud resources with typed edges, find all viable paths from entry points (internet-exposed) to targets (sensitive data). The interviewer evaluates your graph algorithm knowledge and ability to optimize for scale.
What the Interviewer Expects
- Model the problem correctly as a graph traversal from source set to target set
- Implement an efficient BFS/DFS solution with cycle detection
- Optimize for large graphs: pruning, memoization, bounded depth
- Handle edge cases: disconnected components, self-loops, no valid paths
- Analyze time and space complexity
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you modify your solution to find only the shortest attack paths?
- Can you parallelize the path finding across multiple workers?
- How would you handle weighted edges where some attack steps are easier than others?
- What if the graph has millions of nodes but paths are typically under 10 hops?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Problem Analysis
The problem involves finding all paths in a directed graph from any internet-exposed resource (sources) to any resource containing sensitive data (targets). The key patterns applicable here are:
- **...
Approach
We will implement a DFS approach to explore all paths from sources to targets. The steps are as follows:
- Graph Representation: Represent the graph using an adjacency list for efficient traversa...