Code Room
Vibe codingMediumvc-g162
Subject Ai code reviewLevel Mid–Senior~15 minCommon in Security interviewsIndustries Software development

Question

An AI agent generated this security group for a Postgres RDS instance after you said "let the app servers reach the database." It applies and the app connects fine in staging. What's the problem?

hcl
resource "aws_security_group" "db" {  name   = "prod-db-sg"  vpc_id = var.vpc_id   ingress {    description = "Postgres"    from_port   = 5432    to_port     = 5432    protocol    = "tcp"    cidr_blocks = ["0.0.0.0/0"]  }   egress {    from_port   = 0    to_port     = 0    protocol    = "-1"    cidr_blocks = ["0.0.0.0/0"]  }}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.