メインコンテンツへスキップ

Droid Shieldとは?

Droid Shieldは、コミットしてリモートにプッシュする前に、未コミットの変更を自動的にスキャンして潜在的なシークレットを検出する組み込みセキュリティ機能です。APIキー、トークン、パスワードなどの機密認証情報がバージョン管理履歴に誤って公開されることを防ぐセーフティネットとして機能します。
Looking for advanced protection? Droid Shield Plus provides AI-powered security scanning with prompt injection detection, enhanced secrets detection, and sensitive data protection. Available for enterprise customers.

Droid Shieldの動作原理

Droidを使用してgit commitまたはgit push操作を実行すると、Droid Shieldは自動的に以下を行います:
  1. 差分をスキャン - 追加される行のみを分析(削除や変更されていない行は対象外)
  2. シークレットを検出 - パターンマッチングを使用して潜在的な認証情報を識別
  3. 実行をブロック - シークレットが検出された場合、git操作を停止
  4. 検出結果を報告 - 潜在的なシークレットが見つかった正確な場所を表示
Droid Shield only scans git operations performed through Droid. Manual git commands run outside of Droid are not affected.

Droid Shieldが検出する対象

Droid Shieldは、以下を含む幅広い認証情報パターンをスキャンします:

API Keys & Tokens

Factory API keys, GitHub tokens, GitLab tokens, npm tokens, and API keys from (e.g. AWS, Google Cloud, Stripe, SendGrid) and more.

Authentication Credentials

(e.g. JWT, OAuth, session tokens), and URLs with embedded credentials.

Private Keys

(e.g. SSH private keys, PGP keys, age secret keys, OpenSSH keys), and other cryptographic key formats.

Service-Specific Secrets

(e.g. Slack webhooks and tokens, Twilio credentials, Mailchimp keys, Square OAuth secrets, Azure storage keys).

検出アルゴリズム

Droid Shieldは、ランダム性検証を伴うスマートパターンマッチングを使用します:
  • パターンマッチング - フォーマットによる認証情報の識別
  • ランダム性チェック - キャプチャされた値が実際のシークレットのように見えるかを検証
  • コンテキスト認識 - 変数名と代入パターンを考慮して誤検出を減らす

Droid Shieldが起動するタイミング

Droid Shieldは以下のgit操作中に自動的に起動します:
  • git commit - コミット作成前にステージされた変更をスキャン
  • git push - リモートにプッシュされるコミットをスキャン
If secrets are detected, the git operation is blocked to prevent credential exposure. You’ll need to remove the secrets before proceeding.

Droid Shield設定の管理

CLIでの操作

設定メニューからDroid Shieldのオン/オフを切り替えることができます:
  1. droidを実行
  2. /settingsを入力
  3. **「Droid Shield」**設定を切り替え
  4. 変更は即座に有効になります
Droid Shield is enabled by default for your protection. We strongly recommend keeping it enabled.

シークレットが検出された場合の対処法

Droid Shieldが潜在的なシークレットを検出すると、以下のようなエラーメッセージが表示されます:
Droid-Shield has detected potential secrets in 2 location(s) across files:
src/config.ts, .env.example

If you would like to override, you can either:
1. Perform the commit/push yourself manually
2. Disable Droid Shield by running /settings and toggling the "Droid Shield" option

推奨される対処方法

1

Review the findings

Carefully examine the files and lines mentioned to identify what was detected.
2

Remove the secrets

  • Use environment variables instead of hardcoded credentials
  • Move secrets to secure credential stores
  • Add sensitive files to .gitignore
  • Use git filter-branch or BFG Repo-Cleaner if secrets were already committed
3

Retry the operation

Once secrets are removed, run the git command again through Droid.
Never disable Droid Shield just to bypass the check. Exposed credentials can lead to security breaches, unauthorized access, and compliance violations.

誤検出の場合

Droid Shieldは慎重を期すために保守的なパターンを使用します。検出が誤検出だと思われる場合:
  1. 実際のシークレットでないことを確認 - その値が機密情報でないことを再確認
  2. 手動コミットを使用 - Droid以外でgit操作を直接実行
  3. パターンを報告 - 繰り返し発生する誤検出がある場合はsupport@factory.aiまでご連絡ください

ベストプラクティス

Store all secrets in environment variables or secure credential managers, never hardcode them in source files.
# Good - Using environment variable
const apiKey = process.env.FACTORY_API_KEY;

# Bad - Hardcoded secret
const apiKey = "fk-abc123xyz789...";
Droid Shield provides an essential safety layer. Keep it enabled at all times, especially in team environments.
Even with Droid Shield, manually review your changes before committing to ensure no sensitive data is included.
Make sure all team members understand how Droid Shield works and why it’s important to keep it enabled.

制限事項

Droid Shield is a detection tool, not a guarantee. While it catches many common secret patterns, it cannot detect:
  • Custom secret formats not in the pattern database
  • Secrets that don’t follow recognizable patterns
  • Obfuscated or encoded credentials
  • Business logic vulnerabilities or code security issues
Always follow security best practices and never rely solely on automated tools for secret protection.

関連リソース


サポートが必要ですか?

Security Questions

Email our security team: security@factory.ai

False Positives

Contact support@factory.ai to report persistent false positive patterns.