What are graph checks in Checkov?

IntermediateConceptCheckov
Answer

Short answer

Graph checks (IDs like CKV2_...) evaluate relationships between resources, not just one resource's attributes. For example: "this S3 bucket must have a separate aws_s3_bucket_public_access_block resource attached" or "this EC2 instance must be attached to a security group that doesn't allow 0.0.0.0/0". Checkov builds a graph of the Terraform resources to answer these.

Why they matter

Modern Terraform splits configuration across resources (AWS provider v4+ moved bucket encryption, versioning and ACLs into separate resources). Single-resource checks would miss whether those companion resources exist.

Example findings

CKV2_AWS_6:  Ensure that S3 bucket has a Public Access block
CKV2_AWS_62: Ensure S3 buckets should have event notifications enabled
CKV2_AWS_5:  Ensure that Security Groups are attached to another resource

Writing one (YAML connection condition)

definition:
  cond_type: connection
  resource_types: [aws_s3_bucket]
  connected_resource_types: [aws_s3_bucket_public_access_block]
  operator: exists

What to say in the interview

"Graph checks evaluate connections between resources — like whether a bucket has a public access block resource attached — which matters because modern Terraform splits settings across resources. Checkov builds a resource graph to evaluate them, and you can write connection-based custom policies in YAML."

All Security Tools questions Roadmap: Checkov — IaC security

More on Checkov