Skip to content

Add webhook endpoint with signature verification and IP allowlist #52

Description

@liplus-lin-lay

目的

rag-mcp Worker に GitHub Webhook 受信エンドポイントを追加し、セキュリティレイヤー(署名検証 + IP allowlist)を実装する。

前提

  • github-webhook-mcp に実証済みの署名検証・IP allowlist パターンが存在する
  • HMAC-SHA256 署名検証: WebCrypto API 使用
  • IP allowlist: GitHub meta API (https://api.github.com/meta) から動的取得 + Cloudflare Cache API キャッシュ + ハードコードフォールバック
  • GITHUB_WEBHOOK_SECRET 環境変数で署名シークレットを管理

制約

  • 既存のルーティング(MCP, OAuth, admin)を壊さない
  • Workers の CPU 時間制限内で検証を完了する

対象ファイル

  • src/webhook.ts — 新規: webhook 受信ハンドラ、署名検証
  • src/github-ip.ts — 新規: GitHub IP allowlist(webhook-mcp から移植)
  • src/index.ts — ルーティング追加(POST /webhooks/github)
  • wrangler.toml — GITHUB_WEBHOOK_SECRET の説明コメント
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlog受け入れ済み、着手時期未定enhancement新機能・改善要望

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions