Interview Prep/DevSecOps/Vulnerability Management and OWASP

A pentest report shows SQL injection in a search endpoint of a Java service. How do you handle it end to end?

BeginnerScenarioVulnerability Management and OWASP
Answer

Situation read → Confirmed injection (OWASP A03) in production code. Fix the code, check whether it was exploited, and stop the same class of bug from coming back.

What I'd do →

  1. Reproduce from the report in staging and confirm the vulnerable query.
  2. Replace string concatenation with a parameterised query:
    PreparedStatement ps = conn.prepareStatement(
        "SELECT id, name FROM products WHERE name LIKE ?");
    ps.setString(1, "%" + term + "%");
    
  3. Search access and database logs for injection payloads (' OR 1=1, UNION SELECT, sleep() to see if it was already abused.
  4. Add a Semgrep or CodeQL rule for string-built SQL so the pattern fails in PR.
  5. Make sure the app's DB user has no DDL rights, so the next bug has a smaller blast radius.

Why → One fix closes one hole; the rule closes the class; least-privilege DB access limits what an attacker can do with the next one.

Interview tip → Always mention checking logs for prior exploitation, not just patching.

All DevSecOps questions Roadmap: Security in the pipeline

More on Vulnerability Management and OWASP