Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
ツール/GitHubGitHub/arzaan789/keyguard
静的分析脆弱性スキャナーコード分析構成監査クラウドセキュリティDevSecOpsシークレット検出サプライチェーンセキュリティAPIセキュリティ
GitHubarzaan789/keyguard

keyguard

コードベースとGCPプロジェクトをスキャンして、公開されたAPI認証情報を検出します。

リポジトリを見る
14ヶ月前未レビュー

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

keyguard

コードベース、GCPプロジェクト、CIパイプラインをスキャンして、公開されたGoogle API認証情報を悪用される前に発見します。

問題: Googleは、公開用に設計され、クライアントサイドコードに埋め込まれていた既存のAPIキー(Maps、Placesなど)に対して、Gemini APIアクセスを事後的に有効化しました。チームメンバーが同じGCPプロジェクトでGeminiを有効にすると、すでに公開されていたキーが静かにGemini認証情報となり、プロジェクトが不正なAI使用や8万ドル以上の課金インシデントにさらされることになります(コンテキスト)。

keyguardの機能:

  • keyguard scan — 正規表現とエントロピー検出を使用して、ソースファイルとgit履歴から認証情報文字列を検出
  • keyguard audit — 稼働中のGCPプロジェクトに接続し、現在Geminiアクセス権を持つAPIキーをフラグ付け
  • keyguard ci — GitHub Actions、CircleCI、GitLab CIのログと変数をスキャンし、漏洩した認証情報を検出

インストール

root@kitploit:~
pip install keyguard-scan

または、リポジトリをクローンして開発モードでインストール:

root@kitploit:~
git clone https://github.com/arzaan789/keyguard.git
cd keyguard
pip install -e ".[dev]"

クイックスタート

root@kitploit:~
# カレントディレクトリとgit履歴をスキャン
keyguard scan .

# 稼働中のGCPプロジェクトを監査
keyguard audit

# CIプラットフォームをスキャン
keyguard ci

コマンド

keyguard scan

正規表現とShannonエントロピーフィルタリングを使用して、ソースファイルとgit履歴から公開された認証情報をスキャンします。"REPLACE_ME"や"XXXXXXXX"のような低エントロピーのプレースホルダーは自動的に無視されます。

root@kitploit:~
# ディレクトリをスキャン(ファイル+完全なgit履歴)
keyguard scan .

# ファイルのみ、git履歴はスキップ
keyguard scan . --no-git-history

# JSONとSARIFにエクスポート
keyguard scan . --output json --output sarif --out-file report

# 実際のキー値を表示(伏せ字なし)
keyguard scan . --no-redact

# カスタム設定ファイルを使用
keyguard scan . --config /path/to/.keyguard.toml

終了コード: 0 = 問題なし, 1 = 発見あり, 2 = エラー

keyguard audit

Cloud Resource Manager、Service Usage、API Keys APIを介して、稼働中のGCPプロジェクトに接続します。無制限のキー(サイレントGeminiアクセス)や、プロジェクトでGeminiが有効になっている状態でgenerativelanguage.googleapis.comを明示的に許可しているキーをフラグ付けします。

認証はデフォルトでアプリケーションデフォルト認証情報を使用します。最初にgcloud auth application-default loginを実行してください。

root@kitploit:~
# アクセス可能なすべてのGCPプロジェクトを監査
keyguard audit

# 特定のプロジェクトを監査
keyguard audit --project my-project-id --project another-project

# サービスアカウントキーファイルを使用
keyguard audit --gcp-credentials /path/to/key.json

# JSONで結果をエクスポート
keyguard audit --output json --out-file gcp-findings.json

発見:

  • CRITICAL — キーにAPI制限がなく、Geminiが有効(Maps→Geminiへのサイレントアップグレードシナリオ)
  • HIGH — キーが明示的にgenerativelanguage.googleapis.comを許可(意図的だが、クライアントコードに埋め込まれている可能性あり)

keyguard ci

CIプラットフォームのログと保存された変数をスキャンし、公開された認証情報を検出。GitHub Actions、CircleCI、GitLab CIをサポート。

root@kitploit:~
# 設定されたすべてのプラットフォームをスキャン
keyguard ci

# 1つのプラットフォームのみスキャン
keyguard ci --platform github

# 特定のリポジトリに絞り込む
keyguard ci --repo my-org/api-service

# JSONで結果をエクスポート
keyguard ci --output json --out-file ci-findings.json

スキャン対象:

  • GitHub Actions — プレーンテキストのリポジトリ変数 + ワークフロー実行ジョブログ
  • CircleCI — 環境変数名(値はCircleCIによってマスクされます) + パイプラインジョブのステップログ
  • GitLab CI — プロジェクト変数(プレーンテキスト) + パイプラインジョブトレース

keyguard watch

ファイル変更時に再スキャンします。開発中に便利です。

root@kitploit:~
keyguard watch .

keyguard rules list

アクティブなすべての検出ルールを一覧表示します。

root@kitploit:~
keyguard rules list

keyguard config check

.keyguard.toml設定ファイルを検証します。

root@kitploit:~
keyguard config check
keyguard config check --config /path/to/.keyguard.toml

設定

プロジェクトルートに.keyguard.tomlを作成:

root@kitploit:~
[scan]
paths = ["."]
exclude = ["tests/fixtures/", "**/*.example"]
scan_git_history = true

[output]
format = ["terminal", "json"]
redact = true

[notify]
slack_webhook = "https://hooks.slack.com/services/..."

[rules]
disabled = []

# CIプラットフォームの認証とスコープ
[ci]
github_token    = "ghp_xxxxxxxxxxxxxxxxxxxx"
circleci_token  = "CCIPAT_xxxxxxxxxxxxxxxx"
gitlab_token    = "glpat-xxxxxxxxxxxxxxxxxxxx"
gitlab_url      = "https://gitlab.com"   # セルフホストGitLab用に上書き
max_runs        = 10                     # リポジトリあたりの最近の実行/パイプライン数

[ci.github]
orgs  = ["my-org"]
repos = ["my-org/specific-repo"]         # オプション: 特定のリポジトリのみスキャン

[ci.circleci]
orgs = ["my-org"]

[ci.gitlab]
groups = ["my-group"]

検出

Keyguardは正規表現 + Shannonエントロピーアプローチを使用します。各ルールは以下を定義します:

  • 認証情報の構造に一致するパターン(例: Google APIキーのAIza[0-9A-Za-z\-_]{35})
  • 低エントロピープレースホルダーを除外する最小エントロピーしきい値

組み込みルールで検出されるもの:

ルールID検出対象
google-api-keyGoogle APIキー (AIza...) — 静かにGeminiアクセスを付与されたMapsキーを含む
gcp-service-account-keyGCPサービスアカウントRSA秘密鍵

.keyguard.tomlでカスタムルールを追加できます:

root@kitploit:~
[[rules.extra]]
id = "my-internal-token"
description = "内部サービス用トークン"
pattern = "tok-[0-9a-f]{32}"
entropy_min = 3.5
severity = "high"
tags = ["internal"]

CI統合

GitHub Actions

root@kitploit:~
name: keyguard scan

on: [push, pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0          # gitスキャン用の完全な履歴
      - run: pip install keyguard-scan
      - run: keyguard scan .

Pre-commitフック

root@kitploit:~
# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: keyguard
        name: keyguard credential scan
        entry: keyguard scan --no-git-history
        language: system
        pass_filenames: false

Docker

root@kitploit:~
docker run --rm -v $(pwd):/repo ghcr.io/arzaan789/keyguard scan /repo

出力形式

端末 (デフォルト) — 重要度でグループ化された色付きテーブル。

JSON — 機械可読な検出結果配列:

root@kitploit:~
keyguard scan . --output json --out-file findings.json

SARIF — GitHubのSecurityタブやその他のSASTツールと統合:

root@kitploit:~
keyguard scan . --output sarif --out-file findings.sarif

Slack webhook — 検出結果が見つかったときにサマリーを投稿:

root@kitploit:~
[notify]
slack_webhook = "https://hooks.slack.com/services/..."

開発

root@kitploit:~
git clone https://github.com/arzaan789/keyguard.git
cd keyguard
pip install -e ".[dev]"
pytest

143 テスト、0 失敗。

プロジェクト構造:

root@kitploit:~
keyguard/
  scanner/      # ファイル + git履歴スキャナー
  engine/       # 正規表現 + エントロピー検出 (ルール、マッチャー)
  output/       # 端末、JSON/SARIF、webhook
  auditor/      # GCP APIクライアント + 監査ロジック
  ci/           # GitHub Actions、CircleCI、GitLab CIスキャナー
  cli.py        # Click CLIエントリーポイント
  config.py     # .keyguard.tomlローダー

ロードマップ

  • v1 — ファイルスキャナー(ソースコード + git履歴)
  • v2 — GCP API監査(GCP API経由のライブプロジェクト監査)
  • v3 — CIプラットフォーム統合(GitHub Actions、CircleCI、GitLab CI)

ライセンス

MIT

ツールをダウンロード
google-oauth-client-secretGoogle OAuth2クライアントシークレット (GOCSPX-...)