NVIDIAがAIの安全性を検査
NVIDIA SkillSpector Guide: Scanning AI Skills for Security Risks with Static Analysis and SARIF Reports

NVIDIAが開発したSkillSpectorは、AIの機能(スキル)に潜むセキュリティの危険を事前に見つけ出し、AIを安全に使うための重要なツールです。
このチュートリアルでは、NVIDIA SkillSpectorが、AIスキルが実際のワークフローで使用される前にセキュリティリスクを評価するのにどのように役立つかを探ります。私たちは、良性のスキルと意図的に脆弱なスキルの両方を含む管理されたコーパスを構築し、SkillSpectorのプログラム可能なLangGraphワークフローを通じてそれらをスキャンし、結果として得られるリスクスコアと発見事項をpandasで整理します。その後、重大度とカテゴリの分布を視覚化し、SARIF形式で結果をエクスポートし、カスタムアナライザーでフレームワークを拡張し、オプションでより深い検証のためにLLMベースのセマンティック分析を適用します。NVIDIA SkillSpectorのインストールとスキルコーパスの構築
コードをコピーしました。別のブラウザを使用してください。
import os
import sys
import json
import shutil
import textwrap
import subprocess
from pathlib import Path
print("Python:", sys.version.split()[0])
if sys.version_info < (3, 12):
print(" SkillSpector requires Python 3.12+. On Colab pick a 3.12+ runtime.")
def _pip(*args):
subprocess.run([sys.executable, "-m", "pip", "install", "-q", *args], check=True)
print("Installing SkillSpector (+ pandas, matplotlib) — this can take a minute...")
_pip("git+https://github.com/NVIDIA/SkillSpector.git", "pandas", "matplotlib")
import pandas as pd
import matplotlib.pyplot as plt
try:
from skillspector import graph
except Exception as e:
raise SystemExit(f"Could not import skillspector: {e}\n"
f"Make sure the runtime is Python 3.12+, and the install succeeded.")
print(" SkillSpector imported.\n")
WORKDIR = Path("/content/skill_corpus") if Path("/content").exists() else Path("./skill_corpus")
if WORKDIR.exists():
shutil.rmtree(WORKDIR)
WORKDIR.mkdir(parents=True, exist_ok=True)
def write_skill(name: str, files: dict[str, str]):
"""files maps relative path -> file contents."""
root = WORKDIR / name
for rel, content in files.items():
p = root / rel
p.parent.mkdir(parents=True, exist_ok=True)
p.write_text(textwrap.dedent(content).lstrip("\n"), encoding="utf-8")
return root
write_skill("safe-formatter", {
"SKILL.md": """
---
name: s
この記事について質問
記事の内容に答えます。記事外のことは都度ウェブで調べます。