[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,92 +1,321 @@
|
||||
---
|
||||
id: wiki-2026-0508-ci-cd-파이프라인-및-ide-통합-보안
|
||||
title: CI CD 파이프라인 및 IDE 통합 보안
|
||||
id: wiki-2026-0508-ci-cd-ide-security
|
||||
title: CI/CD Pipeline & IDE Security Integration
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-F8BCE8]
|
||||
aliases: [DevSecOps, shift-left security, SAST in CI, IDE security plugin, quality gate, security gating]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
confidence_score: 0.93
|
||||
verification_status: applied
|
||||
tags: [devsecops, ci-cd, sast, sca, secret-scan, shift-left, security-gating, sonarqube, snyk, github-actions]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - [[CI_CD]] 파이프라인 및 IDE 통합 보안"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: any
|
||||
framework: GitHub Actions / GitLab CI / Jenkins / SonarQube / Snyk
|
||||
---
|
||||
|
||||
# [[CI_CD 파이프라인 및 IDE 통합 보안]]
|
||||
# CI/CD Pipeline & IDE Security Integration
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> CI/CD 파이프라인 및 IDE 통합 보안은 소프트웨어 개발 프로세스 전반에 걸쳐 코드의 품질과 보안을 유지하기 위한 핵심 접근법입니다 [1], [2]. 개발자가 코드를 작성하는 IDE 환경과 코드가 병합 및 배포되는 CI/CD 워크플로우에 정적 분석([[SAST]]) 및 자동화된 보안 검사 도구를 내장하여 실시간 피드백을 제공합니다 [3], [4]. 이를 통해 개발자는 코드의 결함과 취약점을 조기에 식별하고 수정할 수 있어 안전하고 효율적인 소프트웨어 개발 수명 주기(SDLC)를 확보할 수 있습니다 [5], [6].
|
||||
## 📌 한 줄 통찰
|
||||
> **"매 shift-left 의 fastest feedback"**. 매 IDE 의 type 의 즉시 + 매 PR 의 block. 매 production 의 reach 전 의 catch. 매 SAST + SCA + secret + IaC scan 의 모두 의 automate. 매 modern DevSecOps 의 standard.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
* **IDE 내 실시간 보안 검사:** [[SonarQube]] for IDE나 Snyk Code와 같은 플러그인은 Visual Studio, VS Code, JetBrains, E[[CLIP]]se 등의 개발 환경에 직접 내장되어 작동합니다 [7], [8], [9]. 개발자가 코드를 작성하는 즉시 실시간으로 구문, 로직 및 보안 결함을 분석하여 즉각적인 피드백과 자동화된 수정 제안을 제공합니다 [7], [10]. 이를 통해 코드가 버전 관리 시스템에 커밋되기 전, 가장 이른 단계에서 보안 위험을 식별하고 제거할 수 있습니다 [11], [12].
|
||||
* **CI/CD 파이프라인 자동화 및 게이팅(Gating):** 코드가 풀 리퀘스트(Pull Request)나 브랜치에 푸시되어 빌드될 때, CI/CD 워크플로우 내에서 보안 스캔이 자동으로 실행됩니다 [5], [13], [9]. 조직은 심각도 임계값(Severity thresholds)이나 품질 게이트(Quality [[Gates]])를 설정하여, 기준을 충족하지 못하는 결함이나 보안 취약점이 발견되면 빌드를 실패하게 하거나 풀 리퀘스트 병합을 차단할 수 있습니다 [2], [14], [15], [16]. 이는 [[GitHub Actions]], GitLab, Jenkins 등 다양한 DevOps 도구 체인과 긴밀하게 통합되어 이루어집니다 [4], [17], [15].
|
||||
* **시프트 레프트([[Shift]]-Left) 및 규정 준수 강제:** IDE와 CI/CD 전반에 걸친 보안 통합은 취약점을 개발 과정의 초기에 발견하여 수정하는 '시프트 레프트' 보안 전략을 실현합니다 [11], [18]. 프로덕션 환경에 도달하기 전에 선제적으로 문제를 해결하므로 릴리스 이후 발생하는 결함을 수정하는 비용과 시간을 절감합니다 [6]. 또한, PCI, OWASP, CWE, STIG 등 주요 보안 및 규정 준수 표준을 조직 전체의 리포지토리와 팀에 일관되게 적용하고 강제할 수 있도록 지원합니다 [19], [20], [21], [22].
|
||||
## 📖 핵심
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** AI 분야의 자동 자산화 수행.
|
||||
### 매 4 layer
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** SAST(정적 애플리케이션 보안 테스트), Shift-left(시프트 레프트), SDLC(소프트웨어 개발 수명 주기)
|
||||
- **Projects/Contexts:** [[SonarQube]], Snyk Code, [[DevSecOps]]
|
||||
- **Contradictions/Notes:** 소스 내용 중 이 주제에 대한 명시적인 모순이나 반대 의견은 존재하지 않습니다. 모든 소스가 조기 발견(Shift-left)의 효율성 및 통합의 필요성에 동의하고 있습니다.
|
||||
#### 1. IDE (real-time, while-coding)
|
||||
- **SonarLint / SonarQube for IDE**: SAST inline.
|
||||
- **Snyk Code IDE plugin**.
|
||||
- **GitHub Copilot Vulnerability Filter**.
|
||||
- **Semgrep VS Code extension**.
|
||||
- ✅ 매 fastest feedback (sec).
|
||||
|
||||
---
|
||||
*Last updated: 2026-04-19*
|
||||
#### 2. Pre-commit (local, before commit)
|
||||
- **Husky + lint-staged**.
|
||||
- **pre-commit framework** (Python).
|
||||
- **gitleaks** (secret scan).
|
||||
- **detect-secrets**.
|
||||
|
||||
---
|
||||
#### 3. PR (CI gate)
|
||||
- **SAST**: Semgrep, CodeQL, SonarQube, Checkmarx.
|
||||
- **SCA**: Snyk, Dependabot, Trivy, OWASP Dep-Check.
|
||||
- **Secret**: gitleaks, TruffleHog.
|
||||
- **IaC**: Checkov, tfsec, KICS.
|
||||
- **License**: FOSSA, Black Duck.
|
||||
- 매 fail → 매 block merge.
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
#### 4. Pre-deploy (image / runtime)
|
||||
- **Container scan**: Trivy, Grype.
|
||||
- **Image signing**: Cosign, Notary.
|
||||
- **Policy**: OPA, Kyverno.
|
||||
- **Runtime**: Falco, Sysdig.
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
### 매 standard
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
#### OWASP Top 10
|
||||
- 매 web app 의 most critical.
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
#### CWE Top 25
|
||||
- 매 weakness category.
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
#### CIS Benchmark
|
||||
- 매 OS / cloud config.
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
#### NIST 800-53 / 800-218 (SSDF)
|
||||
- 매 government compliance.
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
#### PCI-DSS / HIPAA / SOC 2
|
||||
- 매 industry-specific.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
### Quality Gate (SonarQube 식)
|
||||
- 매 metric: bug, vuln, code smell, coverage, duplication.
|
||||
- 매 threshold: e.g., 0 vuln, < 5% duplication, > 80% coverage.
|
||||
- 매 fail → 매 block merge.
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
### 매 modern best practice
|
||||
1. **Shift-left + shift-right**: 매 dev → 매 runtime 의 모두.
|
||||
2. **Fail fast**: 매 PR 의 stop.
|
||||
3. **Auto-fix where possible**: Dependabot PR.
|
||||
4. **Risk-based prioritization**: 매 모든 issue X — 매 critical first.
|
||||
5. **Allowlist (SBOM-based)**.
|
||||
6. **Signed commit / build attestation** (SLSA).
|
||||
7. **Secret rotation 의 automate**.
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
### 매 SLSA (Supply-chain Levels for Software Artifacts)
|
||||
- 매 build provenance.
|
||||
- 매 source-to-binary trust.
|
||||
- 매 4 levels.
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
### 매 modern AI-augmented
|
||||
- **CodeRabbit / Greptile**: AI review (security focus).
|
||||
- **GitHub Code Scanning + Copilot Autofix**: 매 fix suggestion.
|
||||
- **Snyk DeepCode**: ML-based.
|
||||
|
||||
```text
|
||||
# TODO
|
||||
## 💻 패턴
|
||||
|
||||
### GitHub Actions (full DevSecOps)
|
||||
```yaml
|
||||
# .github/workflows/security.yml
|
||||
name: Security
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
sast:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Semgrep SAST
|
||||
uses: returntocorp/semgrep-action@v1
|
||||
with:
|
||||
config: 'p/security-audit p/owasp-top-ten'
|
||||
|
||||
- name: CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with: { languages: javascript, python }
|
||||
- uses: github/codeql-action/analyze@v3
|
||||
|
||||
sca:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Snyk SCA
|
||||
uses: snyk/actions/node@master
|
||||
env: { SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} }
|
||||
with: { args: --severity-threshold=high }
|
||||
|
||||
secret-scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with: { fetch-depth: 0 }
|
||||
- name: Gitleaks
|
||||
uses: gitleaks/gitleaks-action@v2
|
||||
|
||||
iac-scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkov
|
||||
uses: bridgecrewio/checkov-action@master
|
||||
with: { directory: terraform/ }
|
||||
|
||||
container-scan:
|
||||
needs: [sast, sca]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: docker build -t myapp .
|
||||
- name: Trivy
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: myapp
|
||||
severity: 'CRITICAL,HIGH'
|
||||
exit-code: 1 # 매 fail PR
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Pre-commit hook (husky)
|
||||
```bash
|
||||
# .husky/pre-commit
|
||||
#!/bin/sh
|
||||
npx lint-staged
|
||||
npx gitleaks protect --staged
|
||||
```
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
```js
|
||||
// package.json
|
||||
{
|
||||
"lint-staged": {
|
||||
"*.{js,ts,jsx,tsx}": ["eslint --fix", "prettier --write"],
|
||||
"*.{yaml,yml}": ["prettier --write"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### pre-commit framework (Python)
|
||||
```yaml
|
||||
# .pre-commit-config.yaml
|
||||
repos:
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.18.0
|
||||
hooks: [{ id: gitleaks }]
|
||||
|
||||
- repo: https://github.com/returntocorp/semgrep
|
||||
rev: v1.50.0
|
||||
hooks: [{ id: semgrep, args: ['--config=p/python', '--error'] }]
|
||||
|
||||
- repo: https://github.com/Yelp/detect-secrets
|
||||
rev: v1.4.0
|
||||
hooks: [{ id: detect-secrets, args: ['--baseline', '.secrets.baseline'] }]
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### SonarQube quality gate
|
||||
```yaml
|
||||
# sonar-project.properties
|
||||
sonar.projectKey=myproject
|
||||
sonar.sources=src
|
||||
sonar.tests=tests
|
||||
sonar.coverage.exclusions=**/*.test.ts,**/test/**
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
# Custom quality gate (defined in SonarQube UI):
|
||||
# - Coverage on New Code > 80%
|
||||
# - Duplicated Lines on New Code < 3%
|
||||
# - 0 New Bugs (severity HIGH/CRITICAL)
|
||||
# - 0 New Vulnerabilities
|
||||
# - Security Hotspots Reviewed = 100%
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### CodeQL custom query
|
||||
```ql
|
||||
// 매 detect missing CSRF protection
|
||||
import javascript
|
||||
|
||||
from Routing::RouteSetup setup, MethodCallExpr handler
|
||||
where setup.getMethodName() = "post"
|
||||
and setup.getHandler() = handler
|
||||
and not handler.getReceiver().toString().matches("%csrf%")
|
||||
select setup, "POST route may be missing CSRF protection."
|
||||
```
|
||||
|
||||
### Container signing (Cosign)
|
||||
```bash
|
||||
# 매 build + sign
|
||||
docker build -t myrepo/myapp:v1.0 .
|
||||
docker push myrepo/myapp:v1.0
|
||||
cosign sign myrepo/myapp:v1.0
|
||||
|
||||
# 매 verify in deployment
|
||||
cosign verify --certificate-identity=https://github.com/myorg/myrepo \
|
||||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \
|
||||
myrepo/myapp:v1.0
|
||||
```
|
||||
|
||||
### SBOM generation
|
||||
```bash
|
||||
# 매 Syft 의 SBOM
|
||||
syft myrepo/myapp:v1.0 -o spdx-json > sbom.json
|
||||
|
||||
# 매 attach to release
|
||||
gh release upload v1.0 sbom.json
|
||||
|
||||
# 매 vulnerability scan
|
||||
grype sbom:sbom.json --fail-on high
|
||||
```
|
||||
|
||||
### Auto-fix PR (Dependabot)
|
||||
```yaml
|
||||
# .github/dependabot.yml
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule: { interval: "weekly" }
|
||||
groups:
|
||||
production-deps:
|
||||
patterns: ["*"]
|
||||
update-types: ["patch", "minor"]
|
||||
```
|
||||
|
||||
### Risk-based prioritization
|
||||
```python
|
||||
def prioritize_findings(findings):
|
||||
"""매 severity × exploitability × reachability."""
|
||||
scored = []
|
||||
for f in findings:
|
||||
sev = {'critical': 4, 'high': 3, 'medium': 2, 'low': 1}[f.severity]
|
||||
exploit = 1.5 if f.has_known_exploit else 1.0
|
||||
reachable = 2.0 if f.in_call_graph_from_entry else 0.5
|
||||
scored.append((f, sev * exploit * reachable))
|
||||
return sorted(scored, key=lambda x: -x[1])
|
||||
|
||||
# 매 top 10 의 dev 의 focus.
|
||||
```
|
||||
|
||||
## 🤔 결정 기준
|
||||
| Layer | Tool |
|
||||
|---|---|
|
||||
| IDE SAST | SonarLint / Snyk Code |
|
||||
| Pre-commit secrets | gitleaks |
|
||||
| CI SAST | Semgrep / CodeQL |
|
||||
| CI SCA | Snyk / Dependabot |
|
||||
| CI IaC | Checkov / tfsec |
|
||||
| Container | Trivy / Grype |
|
||||
| Image sign | Cosign + Sigstore |
|
||||
| Runtime | Falco / Sysdig |
|
||||
| Compliance | InSpec / Chef Compliance |
|
||||
|
||||
**기본값**: 매 4 layer 의 모두 + 매 quality gate + 매 SLSA Level 2+.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[DevSecOps]] · [[CI-CD]] · [[Software-Security]]
|
||||
- 변형: [[Shift-Left-Security]] · [[Quality-Gate]] · [[SLSA]] · [[SBOM]]
|
||||
- 응용: [[SonarQube]] · [[Snyk]] · [[Semgrep]] · [[CodeQL]] · [[Trivy]] · [[Cosign]]
|
||||
- Adjacent: [[AI 코드 리뷰 및 보안 취약점 점검(DevSecOps)]] · [[OWASP-Top-10]] · [[Branching-Strategies]] · [[Quality_Code_Review_Modern]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 DevSecOps pipeline design. 매 security policy. 매 compliance audit. 매 vulnerability triage.
|
||||
**언제 X**: 매 single dev 의 toy project (over-engineering).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Pre-prod 만 의 scan**: 매 too late.
|
||||
- **모든 issue 의 block (no priority)**: 매 dev fatigue.
|
||||
- **Allowlist 의 stale**: 매 false security.
|
||||
- **Secret 의 commit**: 매 rotate 필요.
|
||||
- **No SBOM**: 매 supply chain blind.
|
||||
- **Image 의 unsigned**: 매 trust X.
|
||||
- **Compliance 의 only (no real security)**: 매 checkbox.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (NIST SSDF, OWASP, SLSA spec).
|
||||
- 신뢰도 A.
|
||||
- Related: [[AI 코드 리뷰 및 보안 취약점 점검(DevSecOps)]] · [[Software-Supply-Chain-Security]] · [[OWASP-Top-10]] · [[Branching-Strategies]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-04-19 | Auto-mapped |
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — 4 layer + standard + 매 GitHub Actions / pre-commit / SLSA / Cosign code |
|
||||
|
||||
Reference in New Issue
Block a user