Repository navigation
API経由の配信性プローブを名乗るスパム登録にダミーのトークンを返す(imastodon) - #594
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
本番のnginxログでスパム登録が成功していたのはPOST /api/v1/accountsだけで、 POST /authは全件422だったため、Webフォーム側は対象にしていない。 upstream追従時のコンフリクトを減らすため、判定はconcernに切り出している。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ユーザ名だけ一致するケースのテストは先の実装でも通るので、ここに同梱している。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
本文なしの200では本物と見分けがつき、パターンを変えて再来されかねないため。 手書きのJSONではなく、保存しないAccessTokenをTokenResponseに通しているのは、 Doorkeeperの設定(有効期限やリフレッシュトークン)が変わっても形がずれないようにするため。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
upstream で POST /api/v1/accounts に deprecate_api が付き、本物の登録には Deprecation ヘッダーが返るようになった。 deprecate_api の before_action より先に弾くとヘッダーが付かず、本物と見分けられるので、弾く位置を後ろに移した。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWbPafc6c8z6wxBdvafPqc
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWbPafc6c8z6wxBdvafPqc
この対策を外してよいかを、来ている件数で決めるため。 目安は、1 か月続けて 0 件になったら外す。 今は lograge の行の allocations の少なさ(1330 台)でダミーを返した登録を見分けられるが、Ruby や Rails の版で数字が動くので、upstream の版を上げたあとは当てにできない。 本番は RAILS_LOG_LEVEL を指定しておらず info で出るので、info にした。 想定どおりに弾けたという記録で、warn 以上で通知するようにしたときに埋もれないようにする。 登録理由は決まった文字列なので出さず、メールアドレスは filter_parameters で伏せる対象なので出さない。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWbPafc6c8z6wxBdvafPqc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#579(imastodon-v4.6)と #580(imastodon-v4.7)を imastodon にポートしたもの。
stable は imastodon から切るので、ここに入れないと次の stable で抜け落ちる。
#579 のコミットはコンフリクト無しで乗った。その上に 2 つ足している。
POST /api/v1/accountsにdeprecate_apiが付いた。弾く位置がその前だと、ダミーにだけ Deprecation ヘッダーが付かず、本物と見分けられる。だから位置を後ろに移した今の状況
2026-10-26 の本番では、ダミーを返した登録が 84 件あった(lograge の
allocationsが 1330 台の 200)。本物と思われる登録は 8 件。
対象外
🤖 Generated with Claude Code
https://claude.ai/code/session_01SWbPafc6c8z6wxBdvafPqc