スキル一覧に戻る
Shen-Ming-Hong

security-vulnerability-fix

by Shen-Ming-Hong

Visual Arduino & MicroPython programming with Blockly in VS Code. Multi-board (Uno, Nano, Mega, ESP32, CyberBrick), WiFi/MQTT IoT, AI cameras (Pixetto, HuskyLens), MCP server for GitHub Copilot. 15 languages. PlatformIO ready.

6🍴 1📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: security-vulnerability-fix description: 修復 npm 依賴安全漏洞的完整工作流程。當使用者提到安全警告、Dependabot alerts、CVE 漏洞、npm audit 問題時自動啟用。包含查詢漏洞、升級依賴、驗證修復、發布版本的完整流程。Fixes npm dependency security vulnerabilities with a complete workflow including Dependabot alert analysis, package upgrades, build verification, version release following semantic versioning. metadata: author: singular-blockly version: '1.0.0' category: security

安全漏洞修復技能 Security Vulnerability Fix Skill

修復 npm 依賴安全漏洞的標準化工作流程。 A standardized workflow for fixing npm dependency security vulnerabilities.

適用情境 When to Use

  • 收到 Dependabot security alerts
  • 執行 npm audit 發現漏洞
  • 需要升級有 CVE 的套件
  • 發布安全修補版本 (PATCH release)

工作流程 Workflow

Phase 1: 漏洞分析 Vulnerability Analysis

  1. 查詢所有安全警告

    gh api repos/{owner}/{repo}/dependabot/alerts --jq '.[] | {number: .number, state: .state, severity: .security_advisory.severity, package: .security_vulnerability.package.name, summary: .security_advisory.summary}'
    
  2. 深入分析特定警告 (取得 CVE、修復版本、CVSS 分數)

    gh api repos/{owner}/{repo}/dependabot/alerts/{alert_number}
    
  3. 確認目前安裝版本

    npm ls {package_name}
    
  4. 評估風險

    • Critical/High: 立即修復
    • Medium: 排程修復
    • Low: 評估是否需要

Phase 2: 版本規劃 Version Planning

  1. 遵循語意化版本規則

    • 純安全修補 → PATCH (x.y.Z)
    • 含新功能 → MINOR (x.Y.0)
    • 有 breaking changes → MAJOR (X.0.0)
  2. 檢查修復版本是否可用

    npm view {package_name} versions --json | tail -5
    

Phase 3: 實施修復 Implementation

  1. 更新 package.json

    • 修改依賴版本
    • 更新專案版本號
  2. 更新 CHANGELOG.md (雙語格式)

    ## [x.y.z] - YYYY-MM-DD
    
    ### 安全性修復 Security Fixes
    
    -   **修復 {套件名稱} {漏洞類型} (CVE-XXXX-XXXX)** (Fix {package} {vulnerability type})
        -   升級 `{package}` 從 x.x.x 至 x.x.x
            Upgraded `{package}` from x.x.x to x.x.x
        -   嚴重程度 Severity: {severity} (CVSS: x.x)
        -   關閉 Dependabot Alert #{number}
            Closes Dependabot Alert #{number}
    
  3. 安裝並驗證

    npm install
    npm run package  # 或 npm run build
    npm run test
    
  4. 產生 VSIX (VS Code 擴充功能專案)

    npx @vscode/vsce package
    

Phase 4: 更新 SECURITY.md Maintenance

如果專案根目錄有 SECURITY.md 文件,需同步更新:

  1. 檢查是否有 Known Issues 區塊記錄此漏洞

    • 如有記錄「等待上游修復」的漏洞,現已修復 → 移除該區塊
    • 如果是全新漏洞且無法立即修復 → 新增到 Known Issues
  2. 更新 Supported Versions 區塊

    • 確保支援版本與目前發布版本一致
    • 範例:0.51.x0.52.x
  3. 更新 Last updated 日期

範例格式:

# Security Policy

## Supported Versions

| Version | Supported          |
| ------- | ------------------ |
| 0.52.x  | :white_check_mark: |
| < 0.51  | :x:                |

## Reporting a Vulnerability

Please report security vulnerabilities by opening a [GitHub Security Advisory](...).

---

_Last updated: YYYY-MM-DD_

Phase 5: 發布流程 Release Process

  1. Git 提交 (遵循 Conventional Commits)

    git add package.json package-lock.json CHANGELOG.md SECURITY.md
    git commit -m "chore(deps): 修復 {package} {漏洞類型} ({CVE})"
    
  2. 建立標籤

    git tag -a v{version} -m "Release v{version} - Security patch for {CVE}"
    
  3. 推送至遠端

    git push origin {branch} --follow-tags
    
  4. 建立 GitHub Release (雙語發布說明)

    gh release create v{version} --title "{Project} v{version} - 安全修補 / Security Patch" --notes-file release-notes.md {vsix_file}
    
  5. 清理暫存檔案

    rm release-notes.md *.vsix
    

Phase 5: 驗證修復 Verification

  1. 確認警告狀態

    gh api repos/{owner}/{repo}/dependabot/alerts/{number} --jq '{state: .state, fixed_at: .fixed_at}'
    
  2. 如果警告未自動關閉 (Dependabot 掃描延遲)

    • 先確認 package-lock.json 在 GitHub 上版本正確
    • 手動關閉警告:
    gh api repos/{owner}/{repo}/dependabot/alerts/{number} -X PATCH -f state="dismissed" -f dismissed_reason="fix_started" -f dismissed_comment="Upgraded to {version} in commit {sha}. See v{release_version} release."
    

雙語發布說明範本 Bilingual Release Notes Template

參考 release-notes-template.md 建立發布說明。

檢查清單 Checklist

  • 查詢並分析安全警告
  • 確認修復版本可用
  • 更新 package.json (依賴 + 版本號)
  • 更新 CHANGELOG.md (雙語格式)
  • 更新 SECURITY.md (移除已修復漏洞、更新支援版本)
  • npm install + build + test 通過
  • 產生 VSIX (如適用)
  • Git commit 遵循 Conventional Commits
  • 建立版本標籤
  • 推送至遠端
  • 建立 GitHub Release (雙語發布說明)
  • 驗證警告已關閉
  • gh api - GitHub CLI API 操作
  • npm audit - 本地漏洞掃描
  • npm ls - 查看依賴樹
  • npx @vscode/vsce package - VS Code 擴充功能打包

スコア

総合スコア

75/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です