Files
2nd/10_Wiki/Topic_Programming/AI_and_ML/Semgrep Assistant.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

4.3 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-semgrep-assistant Semgrep Assistant 10_Wiki/Topics verified self
Semgrep AI
Semgrep Assistant
SAST AI
none A 0.9 applied
security
sast
ai-tools
code-scanning
2026-05-10 pending
language framework
python Semgrep / Semgrep Cloud

Semgrep Assistant

매 한 줄

"매 SAST + LLM 의 결합 — false positive triage, custom rule 자동 생성, autofix". 매 Semgrep (pattern-based static analysis) 위에 LLM layer 를 얹어 매 noise 를 줄이고 매 fix PR 을 제안. 매 2026: Claude Opus 4.7 backend, MCP integration 으로 IDE / CI 양쪽 지원.

매 핵심

매 Semgrep 기초

  • Pattern matching on AST. 매 pattern: $X == null && $X.foo() 같은 syntactic rule.
  • 30+ language. 매 community + paid Pro rules.
  • 매 fast (<1 min for typical repo), 매 deterministic.

매 Assistant 가 추가하는 것

  • Triage: 매 finding 에 대해 LLM 이 "true positive 확률" + reasoning. 매 noise -60~80%.
  • Autofix: 매 secure replacement code suggestion → PR comment.
  • Custom rule generation: 매 자연어 → Semgrep YAML rule.
  • Code understanding: data-flow context 추가 ("user input from line 42 reaches sink at line 87").

매 응용

  1. CI gate — 매 PR block on critical findings only.
  2. Backlog cleanup — 매 legacy finding triage.
  3. Custom org rule (e.g., "internal logger 만 사용") generation.
  4. Secret scanning + remediation.

💻 패턴

CLI scan

semgrep --config=auto .
semgrep --config=p/owasp-top-ten --sarif --output=results.sarif .

Custom rule

# rules/no-eval.yml
rules:
  - id: no-eval
    pattern: eval(...)
    message: "eval() 매 dangerous"
    severity: ERROR
    languages: [python]

Generate rule from natural language (Assistant API)

import requests
r = requests.post(
    "https://semgrep.dev/api/v1/assistant/rules",
    headers={"Authorization": f"Bearer {SEMGREP_TOKEN}"},
    json={"description": "Detect hardcoded JWT signing keys in Go"},
)
print(r.json()["rule_yaml"])

CI integration (GitHub Actions)

- uses: semgrep/semgrep-action@v1
  with:
    config: p/ci
    auditOn: push
  env:
    SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
    SEMGREP_ASSISTANT: "1"  # enable AI triage

Pre-commit

# .pre-commit-config.yaml
- repo: https://github.com/returntocorp/semgrep
  rev: v1.95.0
  hooks:
    - id: semgrep
      args: ['--config=p/python', '--error']

MCP server (IDE)

// claude desktop config
{
  "mcpServers": {
    "semgrep": {
      "command": "uvx",
      "args": ["semgrep-mcp"],
      "env": {"SEMGREP_APP_TOKEN": "..."}
    }
  }
}

Programmatic triage

from semgrep_python import scan
findings = scan(target=".", config="p/security-audit")
for f in findings:
    if f.assistant_triage.likelihood == "true_positive":
        create_jira_issue(f)

매 결정 기준

상황 Approach
Open source repo, free SAST semgrep CLI + community rules
Org with high noise SAST Semgrep Pro + Assistant
Want fix PR auto Assistant autofix
Highly custom domain rules Assistant rule generation
CodeQL already in place 보완 (different engine)

기본값: semgrep --config=p/ci in CI + Assistant for triage.

🔗 Graph

🤖 LLM 활용

언제: SAST noise 가 높아 triage backlog 누적. 매 custom rule 작성 진입장벽 낮추기. 언제 X: 매 license-sensitive (Pro tier 비용). 매 zero-network env (assistant 는 cloud).

안티패턴

  • Trust autofix blindly: 매 review 필수. LLM 가 logic 바꿀 수 있음.
  • Disable rule by Assistant verdict alone: false negative 위험. 매 sample audit.
  • Replace human review: 매 augment, not replace.

🧪 검증 / 중복

  • Verified (semgrep.dev docs, Semgrep blog 2024-2026).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — Assistant features + MCP 2026