fix(auth): ротация API-токена против token fixation - #435
Closed
Ibochkarev wants to merge 1 commit into
Closed
Conversation
Ibochkarev
force-pushed
the
fix/issue-412-token-fixation-rotation
branch
4 times, most recently
from
July 28, 2026 04:50
ee85d13 to
658244e
Compare
16 tasks
Ibochkarev
force-pushed
the
fix/issue-412-token-fixation-rotation
branch
2 times, most recently
from
July 29, 2026 11:32
81a9cce to
b2ea3b8
Compare
Rebinding a planted guest cookie to the victim account let an attacker keep the same token after login. Always issue a new API token, migrate the guest draft when safe, revoke the old guest/own token, and regenerate the session id.
Ibochkarev
force-pushed
the
fix/issue-412-token-fixation-rotation
branch
from
August 1, 2026 09:34
b2ea3b8 to
bbf1eb6
Compare
Member
|
Закрываю как субсумированный #321 (влит в beta,
Регресс-покрытие ротации уже в beta (session-семантика — Если в #321-версии найдётся пробел относительно этого PR — переоткроем точечно. Спасибо! |
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.
Описание
На login / register (auto-login) / email verify / checkout auto-login больше не делается rebind guest API-токена к аккаунту. Выдаётся новый токен, guest draft мигрирует при безопасном владельце, старый guest/own токен отзывается, вызывается
session_regenerate_id(true).Закрывает классический token fixation: planted
ms3_token=Tпосле входа жертвы больше не даёт доступ по тому жеT.Тип изменений
Связанные Issues
Closes #412
Смежно с #369 (checkout email capture) — здесь ещё и
Customer::autoLoginCustomerпереведён на тот жеestablishApiSession.Как это было протестировано?
Gate E (эта сессия):
php -ltouched PHP — OKphp tests/ApiTokenRotationPolicyTest.php— OK (policy + regression guards)composer ci:php— OK (exit 0)Vue — n/a
Ручное тестирование
Автоматические тесты (
composer ci:php)Тестирование на разных версиях PHP/MODX
Конфигурация тестирования:
fix/issue-412-token-fixation-rotationСкриншоты (если применимо)
n/a
Чеклист
Дополнительные заметки
Поведение для клиентов: после login/register/verify в ответе/cookie приходит новый
token(значение меняется). Guest-корзина сохраняется через migrate draft.Отложено (не блокер): Register при редком fail
createTokenпосле уже созданного customer отдаёт failure (повтор → email занят). Follow-up UX.Review: code-reviewer, thermo-nuclear, security-review, silent-failure-hunter; 1 fix-loop (checkout autoLogin + migrate hardening + HTML verify).