Skip to content

fix: Sentry のボット/スキャナーノイズをフィルタ#250

Merged
coji merged 1 commit intomainfrom
fix/sentry-noise-filter
Mar 25, 2026
Merged

fix: Sentry のボット/スキャナーノイズをフィルタ#250
coji merged 1 commit intomainfrom
fix/sentry-noise-filter

Conversation

@coji
Copy link
Owner

@coji coji commented Mar 25, 2026

Summary

  • beforeSend で react-router internal エラー (404/400) を Sentry に送信しないようフィルタ
  • handleError で Error オブジェクトの internal 404/400 も早期フィルタ(Sentry イベント生成コストを回避)
  • webhook ルートに loader を追加し GET リクエストに 405 を返す(missing loader エラー解消)

Background

Sentry 導入後、ボット/スキャナーによる .php パスへのアクセス(UPFLOW-3: 382件)や webhook への GET リクエスト(UPFLOW-7)がノイズとして大量に記録されていた。

Test plan

  • pnpm validate 通過(lint, format, typecheck, build, test)
  • デプロイ後 Sentry で新規ノイズイベントが発生しないことを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • バグ修正
    • エラー報告の精度を向上させました。特定のルーティングエラー(404、400 ステータス)が不要な通知を発生させない改善を実施
    • GitHub Webhook API エンドポイントのセキュリティを強化し、不正なリクエストメソッドに対する保護を追加

- beforeSend で react-router internal エラー (404/400) を Sentry に送信しない
- handleError で Error オブジェクトの internal 404/400 も早期フィルタ
- webhook ルートに loader を追加し GET リクエストに 405 を返す

Fixes UPFLOW-3, UPFLOW-4, UPFLOW-7

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f08029b9-9ecf-4bce-8e67-cb9b1294390e

📥 Commits

Reviewing files that changed from the base of the PR and between 8dee439 and fd613c4.

📒 Files selected for processing (3)
  • app/entry.server.tsx
  • app/routes/api.github.webhook.ts
  • instrument.server.mjs

📝 Walkthrough

Walkthrough

React Routerの内部エラー(ステータス404/400)に対するSentry報告の抑制ロジックをアプリケーション全体で追加・強化し、GitHub Webhookエンドポイントに対するGET リクエストの明示的な拒否を実装しました。

Changes

Cohort / File(s) Summary
Sentry エラーレポート抑制
app/entry.server.tsx, instrument.server.mjs
React Routerの内部エラーでステータスが404または400の場合、Sentryへの報告を抑制するロジックを追加。entry.server.tsxでは事前チェック、instrument.server.mjsではSentryのbeforeSendフックで検出・フィルタリング。
GitHub Webhook ローダー
app/routes/api.github.webhook.ts
GET/ローダーメソッドに対して405 Method Not Allowedレスポンスを返すloaderハンドラーを追加。既存のPOST専用のactionハンドラーに加えて、明示的なメソッド拒否を実装。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰✨ エラーログの静寂を求めて
Sentryの迷路を新たに整える
404と400よ、そっと消えたまえ
GitHub Webhookは門番強く
バグ狩りの旅は続く 🌙

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sentry-noise-filter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coji coji merged commit d2f038f into main Mar 25, 2026
6 checks passed
@coji coji deleted the fix/sentry-noise-filter branch March 25, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant