Code Room
Vibe codingHardvc-g016
Subject Ai code reviewLevel Senior–Staff~19 minCommon in Security interviewsIndustries IT services, Software development

Question

An AI assistant generated this Go HTTP handler for an internal ops tool that pings a host the user supplies, to check reachability. It works when you test it with `8.8.8.8`. Review it before it goes on the internal network.

go
func pingHandler(w http.ResponseWriter, r *http.Request) {    host := r.URL.Query().Get("host")    cmd := exec.Command("sh", "-c", "ping -c 1 "+host)    out, err := cmd.CombinedOutput()    if err != nil {        http.Error(w, string(out), http.StatusInternalServerError)        return    }    w.Write(out)}
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.