Skip to content

Graph

From docs/MCP_TOOLS.md on GitHub

The graph tools read three views of the same edges, each built lazily and cached per dataset:

  • The relationship graph (GraphBuilder, a NetworkX DiGraph): edges as collected, read "source verb target". Placeholder nodes such as 0.0.0.0/0 appear when an edge points at something that is not an asset. The graph holds one edge per pair of nodes: parallel SECURITY_GROUP_RULE, NACL_RULE and INTERNET_EXPOSED edges with the same CIDR and direction are merged into one edge whose port_range and protocol are comma lists, and any other parallel edge replaces the earlier one.
  • The flow graph (Dataset.flow_graph): the network-flow hops of cloudg.graph.reachability.network_flow_graph(), the same walk the internet-exposure analysis uses, plus the identity edges (ASSUMES_ROLE, IAM_TRUST, GRANTS_ACCESS) as explicit pivots, because an attacker who reaches a workload can use its role. Flow hops follow INTERNET_EXPOSED, ingress rules, ROUTE, PEERING and LOAD_BALANCER_TARGET edges, CONTAINS only out of a VPC, VNet or subnet, ATTACHED_TO forward from a network interface or public IP, and ATTACHED_TO backwards from a security group, NSG or NACL to what is attached to it, since traffic a group admits reaches those resources. Path results label those reversed hops SG_ADMITS. Egress rules, INVOKES and the other typed edges are not traffic paths. find_paths in flow mode and attack_paths use it.
  • The dependency graph (cloudg.inventory.dependencies.DependencyGraph): each edge turned into a "dependent needs dependency" arrow. forward edge types (REFERENCES, ATTACHED_TO, ROUTE, PEERING, USES_IMAGE, ASSUMES_ROLE, LOGS_TO, LOAD_BALANCER_TARGET, GRANTS_ACCESS, IAM_POLICY_ATTACHMENT, IAM_TRUST) make the source depend on the target; reverse types (CONTAINS, INVOKES, PROTECTS, MONITORS, MANAGES, GOVERNS) make the target depend on the source; SECURITY_GROUP_RULE, NACL_RULE and INTERNET_EXPOSED create no dependency. depends_on, dependents, dependency_tree, shared_dependencies, largest_blast_radius and the first half of blast_radius use it. INVENTORY_REFERENCE.md sections 6 and 12 have the full table.

neighbors and get_edges read the raw edge list, so parallel edges are all reported.

Sections