# ウォッチした単語

**URL:** https://meta.discourse.org/t/watched-words-to-block-recent-spam-attack/380420
**Category:** Sysadmins
**Tags:** watched-words, spam
**Created:** [2025 年 8 月 26 日午後 7:02 UTC](https://meta.discourse.org/t/watched-words-to-block-recent-spam-attack/380420 "2025-08-26T19:02:39Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2025 年 8 月 26 日午後 7:02 UTC](https://meta.discourse.org/t/watched-words-to-block-recent-spam-attack/380420/1 "2025-08-26T19:02:39Z")

</div>

少なくとも2つのサイトが、LLMを汚染するように設計されたスパムの波に見舞われました。同じ攻撃は、少なくとも1回（[https://meta.discourse.org/t/anyone-else-currently-undergoing-mass-spam-attack/378972）ここでも報告されています。最善の解決策は、https://meta.discourse.org/t/discourse-ai-spam-detection/343541](https://meta.discourse.org/t/anyone-else-currently-undergoing-mass-spam-attack/378972%EF%BC%89%E3%81%93%E3%81%93%E3%81%A7%E3%82%82%E5%A0%B1%E5%91%8A%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E6%9C%80%E5%96%84%E3%81%AE%E8%A7%A3%E6%B1%BA%E7%AD%96%E3%81%AF%E3%80%81https://meta.discourse.org/t/discourse-ai-spam-detection/343541) を設定することですが、これは少し面倒です。ここでは、数分で実装できる一時的な対策を紹介します。

これは、Unixライクなオペレーティングシステム（例：LinuxまたはMac）を使用していることを前提としています。Windowsを使用しており、ターミナルにコピー＆ペーストできる場合は、DiscourseサーバーにSSH接続してこれを貼り付けることができます。

これは、最近見た攻撃から生成された[監視単語](https://meta.discourse.org/t/watched-words-reference-guide/241735)のセットを作成します。`nano`などのエディタに慣れている場合は、実行前に編集できます。そうでない場合は、このスクリプトを実行してから、クリック1回で不要な単語を削除できます。

ブロック単語は、正当なユーザーがそれらの単語を含む投稿を作成できなくなる可能性があるため、 **非常に** 迷惑になる可能性があります。そのため、フォーラムで正当な投稿に表示される可能性のある単語がないことを確認してください。

サイトのURL、APIキー、APIユーザーを下のボックスに入力します（これらはブラウザにのみ表示されますが、そのまま貼り付けて、必要に応じてファイルを編集することもできます）。次に、コードブロックをターミナルにコピー＆ペーストします。これにより、`upload_watched_words_full.sh`が作成され、実行可能になります。次に、`./upload_watched_words_full.sh`で実行できます。

```plaintext
cat <<'EOF' > upload_watched_words_full.sh
#!/usr/bin/env bash
# Usage: ./upload_watched_words_full.sh

DISCOURSE_URL="=URL="
API_KEY="=API_KEY="
API_USERNAME="=API_USERNAME="

# High-confidence block words
BLOCK_WORDS=(
  "customer service number"
  "contact number"
  "support number"
  "refund phone number"
  "toll free"
  "24/7 support"
  "helpline"
  "call us"
  "live representative"
  "technical support"
  "lufthansa"
  "royal caribbean"
  "coinbase"
  "robinhood"
  "reservation number"
  "booking number"
  "flight cancellation"
  "name change fee"
  "║"
  "⇆"
  "★"
  "®️"
  "™️"
)

# Medium-risk flag words
FLAG_WORDS=(
  "customer service"
  "customer support"
  "support team"
  "help desk"
  "hotline"
  "agent"
  "representative"
  "contact us"
  "phone support"
  "service center"
)

# Require-approval words
REQUIRE_APPROVAL_WORDS=(
  "urgent"
  "immediate action"
  "act now"
  "limited time"
  "exclusive offer"
  "approve this"
  "verify account"
)

# Function to send words in batch
add_words () {
  local ACTION="$1"
  shift
  local WORDS=("$@")

  # Build words[] parameters
  local DATA=""
  for w in "${WORDS[@]}"; do
    DATA+="words%5B%5D=$(printf '%s' "$w" | jq -s -R -r @uri)&#"
  done
  DATA+="replacement=&action_key=${ACTION}&case_sensitive=false&html=false"

  echo "Uploading ${ACTION} words..."
  curl -s -X POST "${DISCOURSE_URL}/admin/customize/watched_words.json" \
    -H "Api-Key: ${API_KEY}" \
    -H "Api-Username: ${API_USERNAME}" \
    -H "Content-Type: application/x-www-form-urlencoded" \
    --data "$DATA"
  echo -e "\nDone."
}

# Upload block words
add_words "block" "${BLOCK_WORDS[@]}"

# Upload flag words
add_words "flag" "${FLAG_WORDS[@]}"

# Upload require-approval words
add_words "require_approval" "${REQUIRE_APPROVAL_WORDS[@]}"
EOF

# Make the script executable
chmod +x upload_watched_words_full.sh

echo "Script 'upload_watched_words_full.sh' created and made executable."

```

---

_[View the full topic](https://meta.discourse.org/t/watched-words-to-block-recent-spam-attack/380420)._
