"매 CPG 의 의미: 매 AST + CFG + PDG 의 매 single graph representation". 매 Yamaguchi et al. (2014) 가 매 IEEE S&P 의 매 propose, 매 Joern 의 매 implement. 매 2026 modern SAST (Joern, Qwiet AI/ShiftLeft, CodeQL의 dataflow) 의 매 backbone.
매 핵심
매 3 layer
AST (Abstract Syntax Tree): 매 syntactic structure
CFG (Control Flow Graph): 매 execution order, branches
PDG (Program Dependency Graph): 매 data + control dependencies
매 single graph
매 node = AST node
매 edge = AST parent / CFG next / PDG dataflow / call edge
매 query 의 graph traversal 로 매 vulnerability pattern 감지
매 query language
Joern: Scala-based DSL (Gremlin-like)
CodeQL: declarative QL language (similar concept)
Semgrep: 매 simpler (AST-only), 매 not full CPG
매 응용
매 SAST: 매 SQLi/XSS/RCE pattern 의 매 detection.
매 audit: 매 sensitive sink (exec, eval) 의 매 tainted source 까지 trace.
매 academic research: 매 vulnerability mining (CVE 의 retroactive find).
// Joern Scala query: 매 user input 의 SQL 실행 까지 도달
cpg.method.name("query|execute").parameter.reachableBy(cpg.method.name("getParameter|req\\.body").ast).l
언제: 매 Joern Scala query 의 draft, 매 CPG result 의 false positive triage, 매 custom sink/source 의 suggestion.
언제 X: 매 LLM 의 self 의 vulnerability detection — 매 hallucination risk. 매 CPG-based 결과 가 매 ground truth.
❌ 안티패턴
CPG 의 build 만 하고 의 query 의 X: 매 graph 의 사용 안함.
매 source / sink 의 매 default 만: 매 framework-specific (Express, Spring) 의 매 manual 정의 필요.
매 Joern 의 huge codebase 의 timeout: 매 incremental import / 매 module 별 split.
매 alert fatigue: 매 severity tuning 없이 매 모든 finding raise.