revise February 2023 session articles
Build and deploy / deploy (push) Successful in 17s

This commit is contained in:
2026-07-31 14:34:09 +03:00
parent b78758dd3d
commit 6e664b3ca6
7 changed files with 656 additions and 1 deletions
@@ -0,0 +1,51 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 760" role="img" aria-labelledby="sessions-auth-2023-cookie-contract-title sessions-auth-2023-cookie-contract-desc">
<title id="sessions-auth-2023-cookie-contract-title">Контракт cookie и серверной сессии</title>
<desc id="sessions-auth-2023-cookie-contract-desc">Cookie с именем __Host-session несёт непрозрачный ID. Secure, HttpOnly, SameSite, Path и отсутствие Domain ограничивают доставку в браузере. Сервер отдельно проверяет status, current lineage и expiry.</desc>
<style>
.bg { fill: #f7fafc; }
.title { fill: #132238; font: 700 42px Arial, sans-serif; }
.sub { fill: #4b5f76; font: 500 24px Arial, sans-serif; }
.browser { fill: #e8f0fe; stroke: #3972b8; stroke-width: 4; }
.server { fill: #e6f6ec; stroke: #24855d; stroke-width: 4; }
.pill { fill: #ffffff; stroke: #cbd8e6; stroke-width: 2; }
.head { fill: #132238; font: 700 29px Arial, sans-serif; }
.body { fill: #334c65; font: 500 24px Arial, sans-serif; }
.small { fill: #526c85; font: 500 21px Arial, sans-serif; }
.arrow { stroke: #53718e; stroke-width: 7; fill: none; marker-end: url(#sessions-auth-2023-cookie-contract-arrow); }
.divider { stroke: #cbd8e6; stroke-width: 3; }
</style>
<defs>
<marker id="sessions-auth-2023-cookie-contract-arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto"><path d="M0,0 L12,6 L0,12 Z" fill="#53718e"/></marker>
</defs>
<rect class="bg" width="1200" height="760" rx="34"/>
<text class="title" x="64" y="78">Cookie delivery и server validation — разные слои</text>
<text class="sub" x="64" y="118">Flags ограничивают область возврата ID; сервер решает, принимать ли его сейчас.</text>
<rect class="browser" x="64" y="190" width="448" height="480" rx="28"/>
<text class="head" x="98" y="246">Browser cookie</text>
<text class="body" x="98" y="290">__Host-session=opaque-ID</text>
<line class="divider" x1="98" y1="322" x2="476" y2="322"/>
<rect class="pill" x="98" y="350" width="160" height="58" rx="18"/>
<text class="body" x="122" y="388">Secure</text>
<text class="small" x="278" y="388">secure channel</text>
<rect class="pill" x="98" y="426" width="160" height="58" rx="18"/>
<text class="body" x="122" y="464">HttpOnly</text>
<text class="small" x="278" y="464">no JS API</text>
<rect class="pill" x="98" y="502" width="160" height="58" rx="18"/>
<text class="body" x="122" y="540">SameSite</text>
<text class="small" x="278" y="540">Lax scope</text>
<rect class="pill" x="98" y="578" width="160" height="58" rx="18"/>
<text class="body" x="122" y="616">Path=/</text>
<text class="small" x="278" y="616">no Domain</text>
<path class="arrow" d="M526 416 H672"/>
<text class="small" x="546" y="383">Cookie header carries ID</text>
<rect class="server" x="690" y="190" width="446" height="480" rx="28"/>
<text class="head" x="724" y="246">Server session record</text>
<text class="body" x="724" y="290">ID → record</text>
<line class="divider" x1="724" y1="322" x2="1102" y2="322"/>
<text class="body" x="724" y="376">status: active?</text>
<text class="body" x="724" y="428">lineage points here?</text>
<text class="body" x="724" y="480">server expiry valid?</text>
<text class="body" x="724" y="532">authorization passes?</text>
<rect class="pill" x="724" y="574" width="352" height="62" rx="18"/>
<text class="head" x="754" y="615">accept or reject protected effect</text>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,50 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 760" role="img" aria-labelledby="sessions-auth-2023-lifecycle-title sessions-auth-2023-lifecycle-desc">
<title id="sessions-auth-2023-lifecycle-title">Жизненный цикл одной учебной сессии</title>
<desc id="sessions-auth-2023-lifecycle-desc">Вход создаёт active session fixture-s-1. Rotation выводит её в rotated и создаёт fixture-s-2 active. Stale операции старого ID отклоняются. Logout текущего ID revoke-ит запись и возвращает clear cookie.</desc>
<style>
.bg { fill: #f7fafc; }
.title { fill: #132238; font: 700 42px Arial, sans-serif; }
.sub { fill: #4b5f76; font: 500 24px Arial, sans-serif; }
.step { fill: #ffffff; stroke: #cbd8e6; stroke-width: 3; }
.active { fill: #e4f7ee; stroke: #21895e; stroke-width: 4; }
.rotated { fill: #fff3d9; stroke: #bd7b18; stroke-width: 4; }
.revoked { fill: #fde8e8; stroke: #bd3d4a; stroke-width: 4; }
.label { fill: #132238; font: 700 28px Arial, sans-serif; }
.body { fill: #344b64; font: 500 23px Arial, sans-serif; }
.note { fill: #7b3040; font: 700 22px Arial, sans-serif; }
.arrow { stroke: #53718e; stroke-width: 7; fill: none; marker-end: url(#sessions-auth-2023-lifecycle-arrow); }
.thin { stroke: #bd3d4a; stroke-width: 5; fill: none; stroke-dasharray: 12 11; marker-end: url(#sessions-auth-2023-lifecycle-red-arrow); }
</style>
<defs>
<marker id="sessions-auth-2023-lifecycle-arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto"><path d="M0,0 L12,6 L0,12 Z" fill="#53718e"/></marker>
<marker id="sessions-auth-2023-lifecycle-red-arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto"><path d="M0,0 L12,6 L0,12 Z" fill="#bd3d4a"/></marker>
</defs>
<rect class="bg" width="1200" height="760" rx="34"/>
<text class="title" x="64" y="78">Одна сессия: issue → rotation → logout</text>
<text class="sub" x="64" y="118">Серверный record принимает решение; cookie переносит только текущий ID.</text>
<rect class="active" x="64" y="208" width="270" height="214" rx="22"/>
<text class="label" x="92" y="264">1. Вход</text>
<text class="body" x="92" y="310">fixture-s-1</text>
<text class="body" x="92" y="346">status: active</text>
<text class="body" x="92" y="382">generation: 1</text>
<path class="arrow" d="M342 315 H459"/>
<rect class="rotated" x="472" y="208" width="270" height="214" rx="22"/>
<text class="label" x="500" y="264">2. Rotation</text>
<text class="body" x="500" y="310">fixture-s-1</text>
<text class="body" x="500" y="346">status: rotated</text>
<text class="body" x="500" y="382">successor: s-2</text>
<path class="arrow" d="M750 315 H867"/>
<rect class="active" x="880" y="208" width="270" height="214" rx="22"/>
<text class="label" x="908" y="264">3. Current</text>
<text class="body" x="908" y="310">fixture-s-2</text>
<text class="body" x="908" y="346">status: active</text>
<text class="body" x="908" y="382">generation: 2</text>
<rect class="step" x="98" y="538" width="320" height="126" rx="20"/>
<text class="note" x="126" y="588">stale rotate/logout</text>
<text class="body" x="126" y="628">s-1 → reject, s-2 не меняется</text>
<path class="thin" d="M258 532 C334 483 490 472 626 439"/>
<path class="arrow" d="M1015 430 V522"/>
<rect class="revoked" x="814" y="538" width="336" height="126" rx="20"/>
<text class="label" x="842" y="588">4. Logout current s-2</text>
<text class="body" x="842" y="628">revoked + clear cookie</text>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,45 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 760" role="img" aria-labelledby="sessions-auth-2023-stale-events-title sessions-auth-2023-stale-events-desc">
<title id="sessions-auth-2023-stale-events-title">Stale rotation и logout в одной учебной lineage</title>
<desc id="sessions-auth-2023-stale-events-desc">Сервер заменяет fixture-s-1 на fixture-s-2. Повторная rotation и logout старого ID отвергаются и не меняют successor. Logout нового ID revoke-ит его и формирует clear cookie.</desc>
<style>
.bg { fill: #f7fafc; }
.title { fill: #132238; font: 700 42px Arial, sans-serif; }
.sub { fill: #4b5f76; font: 500 24px Arial, sans-serif; }
.lane { fill: #ffffff; stroke: #cbd8e6; stroke-width: 3; }
.active { fill: #e4f7ee; stroke: #21895e; stroke-width: 4; }
.warn { fill: #fff3d9; stroke: #bd7b18; stroke-width: 4; }
.reject { fill: #fde8e8; stroke: #bd3d4a; stroke-width: 4; }
.label { fill: #132238; font: 700 28px Arial, sans-serif; }
.body { fill: #344b64; font: 500 23px Arial, sans-serif; }
.arrow { stroke: #53718e; stroke-width: 7; fill: none; marker-end: url(#sessions-auth-2023-stale-events-arrow); }
.dash { stroke: #bd3d4a; stroke-width: 6; fill: none; stroke-dasharray: 13 10; marker-end: url(#sessions-auth-2023-stale-events-red-arrow); }
</style>
<defs>
<marker id="sessions-auth-2023-stale-events-arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto"><path d="M0,0 L12,6 L0,12 Z" fill="#53718e"/></marker>
<marker id="sessions-auth-2023-stale-events-red-arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto"><path d="M0,0 L12,6 L0,12 Z" fill="#bd3d4a"/></marker>
</defs>
<rect class="bg" width="1200" height="760" rx="34"/>
<text class="title" x="64" y="78">Stale-события не меняют current successor</text>
<text class="sub" x="64" y="118">logout-current: old ID отклонён, active successor остаётся прежним.</text>
<rect class="lane" x="64" y="180" width="1072" height="178" rx="26"/>
<text class="label" x="96" y="230">Server lineage</text>
<rect class="warn" x="286" y="212" width="224" height="110" rx="18"/>
<text class="label" x="316" y="257">fixture-s-1</text>
<text class="body" x="316" y="296">rotated</text>
<path class="arrow" d="M522 267 H674"/>
<rect class="active" x="688" y="212" width="224" height="110" rx="18"/>
<text class="label" x="718" y="257">fixture-s-2</text>
<text class="body" x="718" y="296">active current</text>
<rect class="reject" x="64" y="478" width="290" height="148" rx="22"/>
<text class="label" x="94" y="528">stale rotation s-1</text>
<text class="body" x="94" y="572">reject; no s-3</text>
<path class="dash" d="M352 502 C450 416 508 393 643 332"/>
<rect class="reject" x="440" y="478" width="290" height="148" rx="22"/>
<text class="label" x="470" y="528">stale logout s-1</text>
<text class="body" x="470" y="572">reject; s-2 stays active</text>
<path class="dash" d="M597 474 C655 408 714 384 780 330"/>
<rect class="active" x="816" y="478" width="320" height="148" rx="22"/>
<text class="label" x="846" y="528">logout current s-2</text>
<text class="body" x="846" y="572">revoke + clear cookie</text>
<path class="arrow" d="M927 468 V365"/>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB