Skip to content

feat(widgets): shodan 監査で CDN を肯定的に扱い、応答上限を truncated で断定する - #38

Merged
hitalin merged 1 commit into
mainfrom
feat/shodan-cdn-and-truncation
Aug 9, 2026
Merged

feat(widgets): shodan 監査で CDN を肯定的に扱い、応答上限を truncated で断定する#38
hitalin merged 1 commit into
mainfrom
feat/shodan-cdn-and-truncation

Conversation

@hitalin

@hitalin hitalin commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

#36 / #37 の追従。実インスタンスで動かして分かった 2 点に対応する。

1. CDN の背後は「警告」ではなく「所見」

yami.skimisskey.io も Cloudflare のエッジに解決され、CDN の標準ポートが
11〜13 件すべて「⚠ 要確認」で並んでいた。

🔌 開放ポート 13 件
 ✓ 想定内 80, 443
 ⚠ 2052 要確認
 ⚠ 2053 要確認
 ⚠ 2082 要確認
 … (計 11 件)

しかしそこは利用者のサーバーではなく CDN の共有エッジで、2052 / 2053 / 2082 /
2083 / 2086 / 2087 / 2095 / 2096 / 8080 / 8443 / 8880 は Cloudflare がプロキシに使う
標準ポートである。開いていることは設定不備を意味しない。

さらに言えば、CDN しか見えないこと自体がオリジンを隠せている証拠であり、
第三者が Shodan で引いても同じものしか見えない。これは望ましい状態なので、
警告ではなく肯定的な所見として示すのが正しい。

🛡 CDN の背後にあります  Cloudflare, Inc.
オリジンは公開スキャンから隠れています
以下はエッジの情報です
───────────────
🔌 開放ポート 13 件
 ✓ CDN 標準 80, 443, 2052, 2053, 2082, 2083, 2086, 2087, 2095, 2096, 8080, 8443, 8880

⚠ が 11 件消え、ノイズで本物の問題が埋もれることがなくなる。
CDN 判定でも CDN 標準でないポート (Redis 等) は従来どおり 🚨 で残すので、
握り潰しにはならない (テスト済み)。

なお、オリジンの実 IP を入力して確かめる導線はあえて用意しない
実 IP は隠すべきもので、Shodan の照会ログに乗せる必要がない。

2. 応答上限は truncated で断定する

応答が壊れる件の原因は vault.fetch の 512 KiB 上限だった。

// notedeck: src-tauri/src/vault/fetch.rs:32
const MAX_RESPONSE_BYTES: usize = 512 * 1024;

NoteDeck 側にバグは無い。 打ち切り時は truncated: bool を立てて通知しており
(VaultFetchResponse)、capability 層も { status, headers, body, redactedCount, bytesTotal, truncated } をそのまま素通ししている。こちらがそのフラグを見て
いなかっただけで、これは misstore 側の不具合だった。

同じ Cloudflare でもエッジ IP ごとに Shodan の記録量が違うため、超える IP と
超えない IP がある (yami.ski の 172.66.43.141 は超過、misskey.io の
104.18.26.205 は通過)。これも実測と一致する。

  • res.truncated を見て「応答が 512 KiB の上限を超えました」と断定表示に変更。
    「切れている可能性があります」という推測混じりの文言をやめ、bytesTotal も出す
  • 超過したホストを覚えておき、次回は最初から簡易表示で取得する。通常表示で
    取れたら記憶を消す。上限に二度当たってクレジットを捨てないため

検証

AiScript 1.2.1 の実インタプリタで 13 系統を回帰(既存 11 + CDN + CDN かつ危険ポート)。
全系統で実行時エラー 0 件。

実測データを再現したシナリオで、以下も確認した:

  • 非 CDN では警告が従来どおり出る (SSH / PostgreSQL / Redis / 3000 / 8080)
  • CDN かつ Redis が開いている場合、CDN 標準は畳みつつ Redis は 🚨 で残る
  • 上限超過後に「更新」を押すと自動で ?minify=true になる
  • キャッシュ経路のクレジット消費はゼロのまま

version: 1.0.2 → 1.1.0

🤖 Generated with Claude Code

実インスタンス (yami.ski / misskey.io) で試したところ 2 点わかった。

1. どちらも Cloudflare のエッジに解決され、CDN の標準ポート 11〜13 件が
   すべて「⚠ 要確認」になっていた。しかしそこは利用者のサーバーではなく
   CDN の共有エッジで、開いていて当たり前のポートである。むしろ CDN しか
   見えないこと自体がオリジンを隠せている証拠であり、警告ではなく所見。
   ノイズで本物の問題が埋もれるのを避ける。
2. 応答が壊れる件は vault.fetch の 512 KiB 上限だった
   (notedeck: src-tauri/src/vault/fetch.rs の MAX_RESPONSE_BYTES)。
   NoteDeck は truncated フラグで通知しており、こちらが見ていなかっただけ。
   同じ Cloudflare でもエッジ IP ごとに記録量が違うため、超える IP と
   超えない IP がある (yami.ski は超過、misskey.io は通過)。

- org が CDN 事業者なら「🛡 CDN の背後にあります / オリジンは公開スキャンから
  隠れています / 以下はエッジの情報です」と示し、CDN 標準ポートは想定内に畳む。
  CDN 判定でも Redis 等の非標準ポートは従来どおり 🚨 で残す
- res.truncated を見て「応答が 512 KiB の上限を超えました」と断定表示に変える。
  推測混じりの文言をやめ、bytesTotal も出す
- 超過したホストを覚えておき、次回は最初から簡易表示で取得する。
  通常表示で取れたら記憶を消す。上限に二度当たってクレジットを捨てないため

AiScript 1.2.1 の実インタプリタで 13 系統を回帰 (既存 11 + CDN + CDN かつ
危険ポート)。全系統で実行時エラー 0 件。非 CDN で警告が従来どおり出ること、
超過後の更新が自動で簡易表示になること、キャッシュ経路が 0 クレジットの
ままであることも確認した。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
misstore c7fefc9 Aug 09 2026, 10:24 AM

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@hitalin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5d737550-946f-474c-a52a-74f5aca540c9

📥 Commits

Reviewing files that changed from the base of the PR and between 21045ff and c7fefc9.

📒 Files selected for processing (5)
  • public/registry/index.json
  • public/registry/widgets.json
  • public/registry/widgets/shodan-instance-audit/api.json
  • public/registry/widgets/shodan-instance-audit/meta.json
  • public/registry/widgets/shodan-instance-audit/widget.is

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.

@hitalin hitalin self-assigned this Aug 9, 2026
@hitalin
hitalin merged commit 8eb4923 into main Aug 9, 2026
5 checks passed
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