This release fixes three security advisories; upgrading is recommended:
GHSA-52j5-qrwv-2vf2 (bot token in network errors),
GHSA-fvpw-9jw8-rj3h (filter bypasses) and
GHSA-hv98-r5fx-wc83 (webhook / undecodable updates, union validation cost).
All three were reported by the Anthropic OSS Scanner.
Security
-
CallbackData.pack()now refuses values that would not unpack back unchanged with a self-overlapping multi-character separator (such as"--"), instead of letting the end of one value shift into the next field. Reported by the Anthropic OSS Scanner (ANT-2026-0M5J1VQ7).
GHSA-fvpw-9jw8-rj3h -
MaybeInaccessibleMessageUnionis now discriminated bydate(0meansaiogram.types.inaccessible_message.InaccessibleMessage), so nested messages are validated once instead of once per member, which took time exponential in the nesting depth.
Reported by the Anthropic OSS Scanner (ANT-2026-IOHAUKLG).
GHSA-hv98-r5fx-wc83 -
StateFilter(Group),Group()and"..." in Groupnow match the states of aStatesGroupnested three or more levels deep. Reported by the Anthropic OSS Scanner (ANT-2026-664Y7GWN).
GHSA-fvpw-9jw8-rj3h -
Update.event_typeno longer keeps the last 128 updates alive in a process-wide cache;aiogram.utils.mypy_hacksis removed.
Reported by the Anthropic OSS Scanner (ANT-2026-PX6H5HDK).
GHSA-hv98-r5fx-wc83 -
and_f(...)now passes the data returned by a filter on to the next filters, as filters registered in a row already do. Previously a later filter inand_fdid not see it, and a negated check on that value always passed. Reported by the Anthropic OSS Scanner (ANT-2026-RO3G83HJ).
GHSA-fvpw-9jw8-rj3h -
A filter that returns a coroutine or another awaitable instead of a result, such as a synchronous function or
lambdathat calls an async function, anasync defwrapper around a synchronous function built withfunctools.wraps, orfunctools.partialover aFilterinstance, now raisesTypeErrorinstead of passing for every update. aiogram does not await such results: declare async filters withasync def. Reported by the Anthropic OSS Scanner (ANT-2026-IYO3AS6K).
GHSA-fvpw-9jw8-rj3h -
Fixed the bot token appearing in network errors.
aiogram.exceptions.TelegramNetworkErrorand theaiohttperrors raised byBot.download_file()/Bot.download()now show the token as<bot id>:***in their message and traceback, and keep their type, so existingexceptclauses still catch them.
The original exception is available as.originaland may contain the token.
Reported by the Anthropic OSS Scanner (ANT-2026-4GL80S7S).
GHSA-52j5-qrwv-2vf2 -
List fields of Telegram objects, including nested rich text arrays, now stop validation at the first invalid item instead of collecting one error per item, so a validation error reports only the first invalid item of a list. The minimum supported pydantic version is now 2.8.0.
Reported by the Anthropic OSS Scanner (ANT-2026-NM3LC5D1).
GHSA-hv98-r5fx-wc83 -
Passing filters to a Scene entry point,
on.<event>.enter(...), now emits aDeprecationWarning: these filters were never checked when entering the scene. Put access checks on the handler that enters the scene instead. Reported by the Anthropic OSS Scanner (ANT-2026-9QFTXU7P).
GHSA-fvpw-9jw8-rj3h -
Root filters registered with
dp.update.filter(...)are now checked before the update is dispatched: a rejected update is reported as not handled, and the data a root filter returns is passed to the handlers. Previously these filters were silently ignored, so existingdp.update.filter(...)registrations start being enforced after upgrading. Reported by the Anthropic OSS Scanner (ANT-2026-EZKREY5K).
GHSA-fvpw-9jw8-rj3h -
The "Detected unknown update type" warning no longer includes the update, so Python's warning registry no longer keeps a copy of every such update; the update is logged on
aiogram.eventatDEBUG.
Reported by the Anthropic OSS Scanner (ANT-2026-PI9G2NGU).
GHSA-hv98-r5fx-wc83 -
The webhook handlers now decode the request body as UTF-8 and ignore the charset of the request, which could select a slow codec.
Reported by the Anthropic OSS Scanner (ANT-2026-HL9BRR9S).
GHSA-hv98-r5fx-wc83 -
Undecodable updates are now skipped and reported: an update that fails validation on the webhook path (both modes of
SimpleRequestHandlerandTokenBasedRequestHandler,Dispatcher.feed_raw_updateandDispatcher.feed_webhook_updatewith a dict) is answered with 200 so Telegram stops redelivering it, logged once onaiogram.webhookwith the number of validation errors instead of the full error text, and passed to the errors handlers as anErrorEventwhose update carries onlyupdate_id. Before, background mode lost the error in an unawaited task that rendered it in full on the event loop, and inline mode answered 500.
Reported by the Anthropic OSS Scanner (ANT-2026-KMKQCARC).
GHSA-hv98-r5fx-wc83
Features
-
Added
aiogram.test, an experimental integration testing toolkit for bots,
installed with theaiogram[test]extra.Updates go through your real
aiogram.dispatcher.dispatcher.Dispatcher, so filters,
middlewares, dependency injection, FSM and Scenes run as they do in production. A stateful
fake Telegram answers every Bot API call and applies it to an isolated in-memory world.- Declare chats, users, memberships, forum topics, business connections, communities and
invite links withaiogram.test.Blueprint. - Drive the world through actors (
await user.send("/start"),
await user.click(button),await user.follow_deep_link(), …). Every
aiogram.types.Updatevariant has a trigger. - Assert on the resulting chat state, on the recorded calls, or on which handler and
router handled an update. - The world models messages, polls and reactions, chat administration and membership, the
bot's own rights and profile, forum topics, rich and ephemeral messages, sticker sets,
Telegram Stars and gifts, file uploads and downloads, flood control and a clock the test
controls. Calls the toolkit does not model are recorded and answered with a result
synthesized from their return type.BotTestEnvironment.on()overrides any call per
test.
The pytest plugin loads on its own through a
pytest11entry point;-p no:aiogram
turns it off.The API is provisional and may change incompatibly in minor releases. The parts intended
to stay stable are listed in the toolkit documentation.
#1887 - Declare chats, users, memberships, forum topics, business connections, communities and