mcpField
B
building-vulnerability-dashboard-with-defectdojo

building-vulnerability-dashboard-with-defectdojo

github.com/mukul975セキュリティ35.2k202 回インストール8 週間前に更新
リポジトリ

building-vulnerability-dashboard-with-defectdojo について

DefectDojo を脆弱性管理の中核として導入するためのガイドです。セキュリティチーム向けに、スキャン結果の取り込み、修正状況の追跡、ダッシュボード、REST API による自動化を扱います。

主な機能

  1. 01複数のセキュリティスキャナーの検出結果を集約
  2. 02脆弱性の重複排除と追跡
  3. 03修正の進捗状況を監視
  4. 04エグゼクティブダッシュボードの指標表示
  5. 05REST API による自動化

活用シーン

  1. 01複数スキャナーの結果を一元管理
  2. 02製品ごとの評価における修正状況の追跡
  3. 03CI/CD からスキャン結果をアップロード
  4. 04深刻度と SLA 指標の確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill building-vulnerability-dashboard-with-defectdojo

インストール後、Claude Code で/building-vulnerability-dashboard-with-defectdojoを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

詳細

DefectDojo を使った脆弱性ダッシュボードの構築

概要

DefectDojo は、200 以上のセキュリティツールから検出結果を集約し、結果の重複を排除して、修正の進捗を追跡し、エグゼクティブ向けダッシュボードを提供する、オープンソースのアプリケーション脆弱性管理プラットフォームです。脆弱性管理の中心的なハブとして機能し、CI/CD パイプライン、チケット管理の Jira、通知用の Slack と連携します。DefectDojo は OWASP に基づく分類に対応し、自動化のための REST API を提供します。

使用する場面

  • 環境に DefectDojo の機能を使った脆弱性ダッシュボードをデプロイまたは設定するとき
  • コンプライアンス要件に沿ったセキュリティ制御を確立するとき
  • この分野のセキュリティアーキテクチャを構築または改善するとき
  • この実装を必要とするセキュリティ評価を実施するとき

前提条件

  • Docker と Docker Compose
  • 4GB 以上の RAM、2 コア以上の CPU、20GB 以上のディスク容量
  • PostgreSQL 12 以上(Docker デプロイに含まれます)
  • API 統合スクリプト用の Python 3.9 以上
  • Jira インスタンス(任意、チケット連携用)

デプロイ

Docker Compose によるデプロイ
# Clone DefectDojo repository
git clone https://github.com/DefectDojo/django-DefectDojo.git
cd django-DefectDojo

# Start with Docker Compose (production mode)
./dc-up-d.sh

# Alternative: manual Docker Compose
docker compose up -d

# Check service status
docker compose ps

# View initial admin credentials
docker compose logs initializer 2>&1 | grep "Admin password"

# Access DefectDojo at http://localhost:8080
環境設定
# Key environment variables in docker-compose.yml
DD_DATABASE_ENGINE=django.db.backends.postgresql
DD_DATABASE_HOST=postgres
DD_DATABASE_PORT=5432
DD_DATABASE_NAME=defectdojo
DD_DATABASE_USER=defectdojo
DD_DATABASE_PASSWORD=<secure_password>
DD_ALLOWED_HOSTS=*
DD_SECRET_KEY=<random_64_char_key>
DD_CREDENTIAL_AES_256_KEY=<random_128_bit_key>
DD_SOCIAL_AUTH_GOOGLE_OAUTH2_ENABLED=True

組織構造

階層
Product Type (Business Unit)
  └── Product (Application/Service)
       └── Engagement (Assessment/Sprint)
            └── Test (Scanner Run)
                 └── Finding (Individual Vulnerability)
API による設定
import requests

DD_URL = "http://localhost:8080/api/v2"
API_KEY = "your_api_key_here"
HEADERS = {"Authorization": f"Token {API_KEY}", "Content-Type": "application/json"}

# Create Product Type
resp = requests.post(f"{DD_URL}/product_types/", headers=HEADERS, json={
    "name": "Web Applications",
    "description": "Customer-facing web application portfolio"
})
product_type_id = resp.json()["id"]

# Create Product
resp = requests.post(f"{DD_URL}/products/", headers=HEADERS, json={
    "name": "Customer Portal",
    "description": "Main customer-facing web application",
    "prod_type": product_type_id,
    "sla_configuration": 1,
})
product_id = resp.json()["id"]

# Create Engagement
resp = requests.post(f"{DD_URL}/engagements/", headers=HEADERS, json={
    "name": "Q1 2024 Security Assessment",
    "product": product_id,
    "target_start": "2024-01-01",
    "target_end": "2024-03-31",
    "engagement_type": "CI/CD",
    "status": "In Progress",
})
engagement_id = resp.json()["id"]

スキャナー連携

API 経由でスキャン結果をインポート
# Upload Nessus scan results
curl -X POST "${DD_URL}/reimport-scan/" \
  -H "Authorization: Token ${API_KEY}" \
  -F "scan_type=Nessus Scan" \
  -F "file=@nessus_report.csv" \
  -F "product_name=Customer Portal" \
  -F "engagement_name=Q1 2024 Security Assessment" \
  -F "auto_create_context=true" \
  -F "deduplication_on_engagement=true"

# Upload OWASP ZAP results
curl -X POST "${DD_URL}/reimport-scan/" \
  -H "Authorization: Token ${API_KEY}" \
  -F "scan_type=ZAP Scan" \
  -F "file=@zap_report.xml" \
  -F "product_name=Customer Portal" \
  -F "engagement_name=Q1 2024 Security Assessment" \
  -F "auto_create_context=true"

# Upload Trivy container scan
curl -X POST "${DD_URL}/reimport-scan/" \
  -H "Authorization: Token ${API_KEY}" \
  -F "scan_type=Trivy Scan" \
  -F "file=@trivy_results.json" \
  -F "product_name=Customer Portal" \
  -F "engagement_name=Q1 2024 Security Assessment" \
  -F "auto_create_context=true"
対応スキャナーの種類(一部)
スキャナー種類の文字列形式
NessusNessus ScanCSV/XML
OpenVASOpenVAS CSVCSV
QualysQualys ScanXML
OWASP ZAPZAP ScanXML/JSON
Burp SuiteBurp XMLXML
TrivyTrivy ScanJSON
SemgrepSemgrep JSON ReportJSON
SnykSnyk ScanJSON
SonarQubeSonarQube ScanJSON
CheckovCheckov ScanJSON
CI/CD 連携(GitHub Actions)
# .github/workflows/security-scan.yml
name: Security Scan
on: [push]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Semgrep
        run: |
          pip install semgrep
          semgrep --config auto --json -o semgrep_results.json .
      - name: Upload to DefectDojo
        run: |
          curl -X POST "${{ secrets.DD_URL }}/api/v2/reimport-scan/" \
            -H "Authorization: Token ${{ secrets.DD_API_KEY }}" \
            -F "scan_type=Semgrep JSON Report" \
            -F "file=@semgrep_results.json" \
            -F "product_name=${{ github.event.repository.name }}" \
            -F "engagement_name=CI/CD" \
            -F "auto_create_context=true"

Jira 連携

# Configure Jira integration in DefectDojo settings
jira_config = {
    "url": "https://company.atlassian.net",
    "username": "[email protected]",
    "password": "jira_api_token",
    "default_issue_type": "Bug",
    "critical_mapping_severity": "Blocker",
    "high_mapping_severity": "Critical",
    "medium_mapping_severity": "Major",
    "low_mapping_severity": "Minor",
    "finding_text": "**Vulnerability**: {{ finding.title }}\n**Severity**: {{ finding.severity }}\n**CVE**: {{ finding.cve }}\n**Description**: {{ finding.description }}",
    "accepted_mapping_resolution": "Done",
    "close_status_key": 6,
}

指標とダッシュボード

主要な指標の API クエリ
# Get finding counts by severity
resp = requests.get(f"{DD_URL}/findings/?limit=0&active=true",
                    headers=HEADERS)
findings = resp.json()

# Get SLA breach counts
resp = requests.get(f"{DD_URL}/findings/?limit=0&active=true&sla_breached=true",
                    headers=HEADERS)

# Get product-level metrics
resp = requests.get(f"{DD_URL}/products/{product_id}/",
                    headers=HEADERS)
product_data = resp.json()

参考資料

コメント