1行のYAMLで、パイプライン内の悪意のあるAIモデルをブロックします。
GuardModel は、CI/CDパイプライン内のMLモデルファイルを自動的にスキャンし、悪意のあるコード、脆弱性、セキュリティリスクを検出するGitHub Actionです。pickle の逆シリアル化攻撃、埋め込まれたマルウェア、既知のCVEを検出することで、危険なモデルが本番環境に到達する前にブロックします。
ワークフローに追加:
name: GuardModel Security Scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: guardmodel/scan@v1
これだけです! GuardModel がすべてのモデルファイルをスキャンし、脅威が検出された場合はチェックを失敗させます。
| 拡張子 | フォーマット | スキャナー | リスクレベル |
|---|---|---|---|
.pkl, .pickle | Python Pickle | Pickle Agent | 致命的 |
.pt, .pth | PyTorch | Pickle Agent | 致命的 |
.bin | PyTorch/Transformers | Pickle Agent | 致命的 |
.h5, .hdf5 | HDF5/Keras | Keras Agent | 高 |
.keras | Keras v3 | Keras Agent | 高 |
.onnx | ONNX | ONNX Agent | 中 |
.safetensors | SafeTensors | SafeTensors Agent | 低 |
リポジトリに .guardmodel.yml を作成:
version: 1
# Directories to scan
include:
- models/
- weights/
# Directories to ignore
exclude:
- tests/fixtures/
# Severity threshold to fail CI
fail_on: high # critical, high, medium, low, none
# Allowlist known-safe models by SHA256
allowlist:
- sha256: "abc123..."
reason: "Verified by security team"
# Maximum file sizes
max_file_size: 5GB
max_total_size: 20GB
GuardModel が検出するもの:
os.system、subprocess、eval、execctypes、動的インポートGuardModel セキュリティスキャン
ステータス: FAILED - 2件の脅威を検出
検出結果はGitHubのSecurityタブに、次の情報とともに表示されます:
# Install dependencies
npm install
pip install -r requirements.txt
# Build
npm run build
# Test
npm test
pytest tests/
# Package for release
npm run package
guardmodel/
├── action.yml # GitHub Action definition
├── src/ # TypeScript source
│ ├── index.ts # Entry point
│ ├── orchestrator.ts # Scan coordination
│ ├── config.ts # Configuration
│ ├── walker.ts # File discovery
│ └── reporters/ # Output formatters
├── python/
│ ├── agents/ # Scanner agents
│ │ ├── pickle_agent.py
│ │ ├── keras_agent.py
│ │ ├── onnx_agent.py
│ │ └── safetensors_agent.py
│ └── rules/ # Detection rules
└── tests/ # Test suite
GuardModel は:
MIT
コントリビューションを歓迎します! CONTRIBUTING.md をご覧ください。
| 入力 | 説明 | デフォルト |
|---|
path | スキャンするディレクトリ | . |
config | 設定ファイルのパス | .guardmodel.yml |
fail-on | 失敗と判定する最小重大度 | high |
output-sarif | SARIF出力を生成する | true |
output-json | JSON出力を生成する | true |
comment-on-pr | PRコメントを投稿する | true |
max-file-size | 最大ファイルサイズ | 5GB |
| 出力 | 説明 |
|---|
status | スキャンステータス(passed、failed、error) |
findings-count | 総検出件数 |
critical-count | Critical の検出件数 |
high-count | High の検出件数 |
sarif-file | SARIF出力へのパス |
json-file | JSON出力へのパス |
scan-duration | 所要時間(ミリ秒) |
| ファイル | 重大度 | 脅威 | 詳細 |
|---|
models/model.pkl | Critical | CODE_EXECUTION | os.system 呼び出しを検出 |
models/utils.pt | High | NETWORK | socket.socket の生成 |