Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/AI 코드 리뷰 및 보안 취약점 점검(DevSecOps).md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

6.7 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, inferred_by
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit inferred_by
wiki-2026-0508-ai-코드-리뷰-및-보안-취약점-점검-devsecops AI Code Review + DevSecOps 10_Wiki/Topics verified self
DevSecOps with AI
AI security review
hybrid code review
shift-left security
none B 0.85 conceptual
devsecops
ai-code-review
sast
security
shift-left
owasp
ci-cd
2026-05-09 pending Claude Opus 4.7 (manual cleanup 2026-05-09)

AI Code Review + DevSecOps

📌 한 줄 통찰

Shift-left security. 매 SDLC 의 early 의 SAST + AI review + human. 매 mechanical 의 AI, 매 architectural 의 human.

📖 핵심

Hybrid model

  • AI: pattern matching, syntax, known CVE.
  • Human: business logic, architecture, novel attack.
  • Together: 매 layer 의 different defect class.

Shift-left phases

IDE (real-time)

  • 매 keystroke 의 lint / type.
  • Cursor / Copilot 의 inline.

Pre-commit (local)

  • Husky + lint-staged.
  • 매 dev 의 first defense.

PR (automated)

  • CodeRabbit / Greptile.
  • Snyk / Sonar SAST.
  • 매 dependency check.

CI deep

  • Container scan.
  • Dependency vulnerability.
  • License check.

Pre-deploy

  • Integration security test.
  • DAST (runtime).

Production

  • WAF.
  • RASP (runtime application self-protection).
  • 매 alert / incident.

매 OWASP Top 10 (2021)

  1. Broken Access Control.
  2. Cryptographic Failures.
  3. Injection (SQL, XSS, Command).
  4. Insecure Design.
  5. Security Misconfiguration.
  6. Vulnerable Components.
  7. Authentication Failures.
  8. Software / Data Integrity.
  9. Logging / Monitoring Failures.
  10. SSRF.

→ 매 SAST 의 mostly cover. 매 #4 (insecure design) = human.

Tool stack (2026)

IDE

  • Cursor (AI-native).
  • Snyk Code IDE plugin.
  • GitHub Copilot Chat.

CI / PR

  • CodeRabbit (LLM review).
  • Snyk Code (SAST).
  • Sonar (quality + security).
  • Semgrep (custom pattern).
  • GitHub Advanced Security (CodeQL).

Container

  • Trivy (image scan).
  • Snyk Container.
  • Docker Scout.

Dependency

  • Dependabot.
  • Renovate.
  • Snyk Open Source.

Secret

  • TruffleHog.
  • GitGuardian.
  • 매 pre-commit hook.

DAST

  • OWASP ZAP.
  • Burp Suite.

매 quality gate

PR gate

  • 매 high severity 의 fail.
  • 매 critical CVE 의 block.
  • 매 secret 의 detection 의 block.

Pre-deploy gate

  • 매 manual approve (high-risk).
  • 매 automated test 의 pass.

Compliance

SOC 2

  • 매 audit log.
  • 매 access control.
  • 매 incident response.

PCI DSS (payment)

  • 매 encryption.
  • 매 segmentation.

GDPR (privacy)

  • 매 data minimization.
  • 매 consent.

HIPAA (health)

  • 매 PHI handling.

Vibe coding 의 specific risk

  • 매 AI-generated code 의 security blind spot.
  • 매 prompt injection 의 reproduce.
  • 매 hardcoded secret (LLM 의 example).
  • 매 outdated security practice.

💻 Code

CI workflow

# .github/workflows/devsecops.yml
on: [pull_request, push]

jobs:
  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      
      # Secret scan
      - uses: trufflesecurity/trufflehog@main
        with:
          path: ./
          base: ${{ github.event.repository.default_branch }}
      
      # SAST
      - uses: snyk/actions/setup@master
      - run: snyk code test --severity-threshold=high
      
      # Dependency
      - run: snyk test --severity-threshold=high
      
      # Container
      - run: docker build -t app .
      - uses: aquasecurity/trivy-action@master
        with:
          image-ref: 'app'
          severity: 'CRITICAL,HIGH'
          exit-code: '1'
      
      # SARIF upload (GitHub Security tab)
      - uses: github/codeql-action/upload-sarif@v3

Custom Semgrep rule (prompt injection)

# .semgrep/prompt-injection.yaml
rules:
  - id: llm-prompt-concat
    pattern-either:
      - pattern: |
          $LLM.complete($PROMPT + $USER_INPUT)
      - pattern: |
          $LLM.complete(`...${$USER_INPUT}...`)
    message: |
      Prompt injection: user input concatenated. Use template / sanitize.
    severity: ERROR
    languages: [python, javascript, typescript]

Pre-commit hook (secret + lint)

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/Yelp/detect-secrets
    rev: v1.4.0
    hooks:
      - id: detect-secrets
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
      - id: trailing-whitespace
      - id: check-yaml
  - repo: local
    hooks:
      - id: lint
        name: lint
        entry: npm run lint
        language: system

SARIF (security findings format)

{
  "version": "2.1.0",
  "runs": [{
    "tool": { "driver": { "name": "MyScanner" } },
    "results": [{
      "ruleId": "sql-injection",
      "level": "error",
      "message": { "text": "SQL injection in users.ts:42" },
      "locations": [{
        "physicalLocation": {
          "artifactLocation": { "uri": "src/users.ts" },
          "region": { "startLine": 42 }
        }
      }]
    }]
  }]
}

Renovate (dep update + security)

// renovate.json
{
  "extends": ["config:recommended", ":automergePatch"],
  "vulnerabilityAlerts": {
    "labels": ["security"],
    "automerge": true
  }
}

🤔 결정 기준

Risk Tool layer
Low (lint, style) IDE / pre-commit
Medium (SAST) PR gate (Snyk / Sonar)
High (CVE, secret) PR block + alert
Critical (zero-day) Manual + emergency patch
AI-generated code Enhanced review

기본값: IDE + PR + pre-deploy 의 layered. 매 gate 의 different threshold.

🔗 Graph

🤖 LLM 활용

언제: 매 production system 의 security strategy. 매 vibe coding 의 review. 언제 X: 매 throwaway script. Specific compliance audit (auditor).

안티패턴

  • AI 만 의존: 매 architecture flaw miss.
  • Manual 만: 매 mechanical pattern miss.
  • No quality gate: 매 vulnerability 의 ship.
  • Generic alert (no severity): alert fatigue.
  • No secret scan + AI 의 hardcode: leak.

🧪 검증 / 중복

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-09 Manual cleanup — shift-left + tool stack + code + 결정