{
    "version": "https://jsonfeed.org/version/1",
    "title": "Mayckon Giovani",
    "home_page_url": "https://mayckongiovani.xyz/pensieve/",
    "description": "Principal Systems Engineer specializing in post-quantum cryptography, distributed systems, and security-critical infrastructure.",
    "author": {
        "name": "Mayckon Giovani"
    },
    "items": [
        {
            "id": "https://mayckongiovani.xyz/pensieve/2026-04-stateful-signatures-xmss-lms-without-index-reuse",
            "content_html": "<blockquote>\n<p>Paper/spec-driven systems note. Theme: <strong>PQC that fails because of systems engineering, not math</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>Stateful hash-based signatures (XMSS, LMS/HSS) are attractive in post-quantum migrations because their security rests on hash functions and conservative assumptions. But they hide a non-negotiable constraint: <strong>each one-time signing key must be used at most once</strong>. In practice that means: <em>your signature scheme is only as strong as your crash-consistency and concurrency control</em>. If you cannot guarantee “no index reuse” under retries, rollbacks, snapshots, and partial deployment, you are not deploying PQC — you are deploying a latent signing-key compromise.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p><strong>For XMSS/LMS, correctness is an invariant on durable state.</strong> The cryptography is only the leaf function; the security boundary is the state machine that allocates and commits leaf indices.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li><strong>Index reuse is catastrophic, not “degraded security”.</strong> Treat it like key exfiltration.</li>\n<li><strong>The signing counter is a replicated state machine.</strong> Build it with linearizability, not best-effort databases.</li>\n<li><strong>Crash consistency beats cleverness.</strong> Burning indices is acceptable; reusing indices is not.</li>\n<li><strong>Rollback attacks are real in cloud/edge fleets.</strong> Snapshots, restores, and imaging are an adversary primitive.</li>\n<li><strong>Operational evidence is part of the scheme.</strong> If you can’t prove which indices were used, you can’t prove you’re still secure.</li>\n</ul>\n<h2 id=\"introduction-pragmatic-abstract-why-you-should-care-today\" style=\"position:relative;\"><a href=\"#introduction-pragmatic-abstract-why-you-should-care-today\" aria-label=\"introduction pragmatic abstract why you should care today permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction (pragmatic abstract: why you should care today)</h2>\n<p>The supply-chain incident is not “someone broke SHA-256”. It’s usually one of:</p>\n<ul>\n<li>a compromised CI signer,</li>\n<li>a leaked code-signing key,</li>\n<li>a rollback to an old firmware image and a forged update chain,</li>\n<li>or an operator restoring a “known good” backup that accidentally rewinds signing state.</li>\n</ul>\n<p>In PQC migration programs, stateful hash-based signatures are often proposed for the conservative path: they are standardized, their assumptions are narrow, and they are plausible even under aggressive quantum timelines. <span class=\"citation\" id=\"citation--rfc8391--1\">(<a href=\"#bib-rfc8391\">1</a>)</span> <span class=\"citation\" id=\"citation--rfc8554--2\">(<a href=\"#bib-rfc8554\">2</a>)</span> <span class=\"citation\" id=\"citation--nistsp800208--3\">(<a href=\"#bib-nistsp800208\">3</a>)</span></p>\n<p>But stateful signatures demand that you treat the signing key as a <em>protocol state</em>.</p>\n<p>If you are signing firmware for IIoT devices, you’re signing into an adversarial lifecycle: devices get cloned, images get restored, regional partitions happen, and “just retry” becomes policy. That is exactly the environment where index reuse happens unless you engineer against it.</p>\n<p>I’m writing this the way I operate in Chile: fewer slogans, more invariants. If the system can’t fail, you don’t “enable PQC” — you <strong>prove</strong> that your allocator cannot reuse a leaf index under the failure model you actually have.</p>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your signing state <em>exactly</em> (counter, tree id, subtree, key epoch)?</li>\n<li>Is index allocation linearizable across all signers?</li>\n<li>What happens if a signer crashes <strong>after</strong> producing a signature but <strong>before</strong> persisting state?</li>\n<li>Can an attacker force a rollback of signing state (snapshot restore, disk imaging, DB restore)?</li>\n<li>Do you have evidence (logs, receipts, transparency) that binds each signature to a unique index?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<p>I’ll be explicit because “implicit assumptions” become production incidents.</p>\n<ul>\n<li>Hash functions behave as modeled (preimage/second-preimage resistance).</li>\n<li>Adversary can observe signatures and choose messages (EUF-CMA setting).</li>\n<li>Operators can and will restore from backups; edge devices can and will be imaged.</li>\n<li>Failures include process crashes, disk-full, partial writes, timeouts, and retries.</li>\n<li>Some components may be malicious or compromised (CI worker, signing host), but <em>we still require</em> the non-reuse invariant to hold.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing a brand new signature scheme. Use standardized constructions. <span class=\"citation\" id=\"citation--rfc8391--4\">(<a href=\"#bib-rfc8391\">1</a>)</span> <span class=\"citation\" id=\"citation--rfc8554--5\">(<a href=\"#bib-rfc8554\">2</a>)</span> <span class=\"citation\" id=\"citation--nistsp800208--6\">(<a href=\"#bib-nistsp800208\">3</a>)</span></li>\n<li>Proving detailed cryptographic bounds here. I focus on the systems invariant the proofs depend on.</li>\n<li>Solving global supply chain security. I’m isolating the signer state problem.</li>\n</ul>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<p>This is what “secure deployment” means in operational terms.</p>\n<h3 id=\"p1--unforgeability-euf-cma-in-the-intended-threat-model\" style=\"position:relative;\"><a href=\"#p1--unforgeability-euf-cma-in-the-intended-threat-model\" aria-label=\"p1  unforgeability euf cma in the intended threat model permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>P1 — Unforgeability (EUF-CMA, in the intended threat model)</h3>\n<p>An attacker who sees signatures <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>σ</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><mo>…</mo><mo separator=\"true\">,</mo><msub><mi>σ</mi><mi>q</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\sigma_1,\\dots,\\sigma_q</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7167em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"minner\">…</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03588em;\">q</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span></span></span></span></span> for chosen messages should not be able to produce a valid signature <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msup><mi>σ</mi><mo lspace=\"0em\" rspace=\"0em\">∗</mo></msup></mrow><annotation encoding=\"application/x-tex\">\\sigma^{*}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6887em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.6887em;\"><span style=\"top:-3.063em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">∗</span></span></span></span></span></span></span></span></span></span></span></span></span> for a new message <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msup><mi>m</mi><mo lspace=\"0em\" rspace=\"0em\">∗</mo></msup></mrow><annotation encoding=\"application/x-tex\">m^{*}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6887em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">m</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.6887em;\"><span style=\"top:-3.063em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">∗</span></span></span></span></span></span></span></span></span></span></span></span></span> with non-negligible probability.</p>\n<h3 id=\"p2--no-index-reuse-deployment-invariant\" style=\"position:relative;\"><a href=\"#p2--no-index-reuse-deployment-invariant\" aria-label=\"p2  no index reuse deployment invariant permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>P2 — No index reuse (deployment invariant)</h3>\n<p>For each keypair and each leaf index <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span>, at most one signature is ever produced using the one-time key at <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span>.</p>\n<p>In words: <strong>the key is stateful</strong>. If you cannot enforce P2, P1 is not a meaningful claim.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p><strong>NoReuse:</strong> For a given signing key <code>kid</code>, every leaf index <code>i</code> is used at most once, across all replicas, across all time, including after crash recovery and restores.</p>\n</div>\n<h3 id=\"p3--rollback-resistance-or-rollback-detection\" style=\"position:relative;\"><a href=\"#p3--rollback-resistance-or-rollback-detection\" aria-label=\"p3  rollback resistance or rollback detection permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>P3 — Rollback resistance (or rollback detection)</h3>\n<p>You must prevent or detect state rollback that could cause index reuse. “Detect” is acceptable only if your response is “treat as compromise; rotate; revoke”.</p>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<p>These are the places where teams get hurt: not on paper, but in production.</p>\n<ul>\n<li><strong>Concurrent signers racing on the same counter</strong> (eventual-consistency DB, stale caches).</li>\n<li><strong>Crash after signing but before committing state</strong> → the system “forgets” it used an index.</li>\n<li><strong>Backup restore / snapshot rollback</strong> rewinds the counter.</li>\n<li><strong>Partial deployment</strong> where old/new versions interpret state differently (range reservation, burn semantics).</li>\n<li><strong>Sharded state without coordination</strong> (two regions allocate overlapping index ranges).</li>\n<li><strong>Opaque evidence</strong>: you cannot answer “which indices were used?” during incident response.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>“We store the counter in Postgres” is not a design. The question is: <strong>what isolation level, what recovery semantics, what rollback story, what evidence?</strong></p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<p>Operability is part of correctness for stateful signatures: you need signals that correspond to proof obligations.</p>\n<ul>\n<li><strong>Current index / remaining capacity</strong> (per key id, per subtree).</li>\n<li><strong>Signature rate vs index burn rate</strong> (burn spikes indicate retries/crashes).</li>\n<li><strong>Allocator linearizability signals</strong>: leader changes, term changes, commit lag (if Raft/Paxos).</li>\n<li><strong>Duplicate detection</strong>: any reuse event must page immediately (treat as key compromise).</li>\n<li><strong>State durability health</strong>: fsync latency, WAL lag, disk-full events, snapshot restore events.</li>\n<li><strong>Fleet drift</strong>: which signer version and which state schema is active.</li>\n</ul>\n<h2 id=\"the-mathematical-anatomy-of-the-problem\" style=\"position:relative;\"><a href=\"#the-mathematical-anatomy-of-the-problem\" aria-label=\"the mathematical anatomy of the problem permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Mathematical Anatomy of the Problem</h2>\n<p>Stateful signatures are not hard because Merkle trees are hard. They are hard because <strong>one-time signatures are not “one-time-ish”</strong>.</p>\n<p>I’ll use the XMSS/LMS family (Merkle tree over OTS keys) because that’s the shared shape. <span class=\"citation\" id=\"citation--rfc8391--7\">(<a href=\"#bib-rfc8391\">1</a>)</span> <span class=\"citation\" id=\"citation--rfc8554--8\">(<a href=\"#bib-rfc8554\">2</a>)</span></p>\n<h3 id=\"merkle-signatures-in-one-page\" style=\"position:relative;\"><a href=\"#merkle-signatures-in-one-page\" aria-label=\"merkle signatures in one page permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Merkle signatures in one page</h3>\n<p>You have:</p>\n<ul>\n<li>A Merkle tree of height <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>h</mi></mrow><annotation encoding=\"application/x-tex\">h</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\">h</span></span></span></span></span> with <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msup><mn>2</mn><mi>h</mi></msup></mrow><annotation encoding=\"application/x-tex\">2^h</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8491em;\"></span><span class=\"mord\"><span class=\"mord\">2</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8491em;\"><span style=\"top:-3.063em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">h</span></span></span></span></span></span></span></span></span></span></span></span> leaves.</li>\n<li>Each leaf <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span> commits to a one-time public key <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>i</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\mathrm{pk}_i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.9386em;vertical-align:-0.2441em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2175em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span></span></span></span></span>.</li>\n<li>The global public key is the Merkle root <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{root}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">root</span></span></span></span></span></span>.</li>\n</ul>\n<p>A signature on message <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>m</mi></mrow><annotation encoding=\"application/x-tex\">m</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">m</span></span></span></span></span> at index <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span> contains:</p>\n<ol>\n<li>an OTS signature <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>σ</mi><mi>i</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\sigma_i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.5806em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span></span></span> proving knowledge of <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>i</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\mathrm{sk}_i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span></span></span> for message <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>m</mi></mrow><annotation encoding=\"application/x-tex\">m</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">m</span></span></span></span></span>,</li>\n<li>an authentication path <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>π</mi><mi>i</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\pi_i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.5806em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span></span></span> proving that <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>i</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\mathrm{pk}_i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.9386em;vertical-align:-0.2441em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2175em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span></span></span></span></span> is in the tree under <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{root}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">root</span></span></span></span></span></span>.</li>\n</ol>\n<p>Verification is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">V</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mi>m</mi><mo separator=\"true\">,</mo><mi>i</mi><mo separator=\"true\">,</mo><msub><mi>σ</mi><mi>i</mi></msub><mo separator=\"true\">,</mo><msub><mi>π</mi><mi>i</mi></msub><mo stretchy=\"false\">)</mo><mo>=</mo><mrow><mi mathvariant=\"normal\">V</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">O</mi><mi mathvariant=\"normal\">T</mi><mi mathvariant=\"normal\">S</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>i</mi></msub><mo separator=\"true\">,</mo><mi>m</mi><mo separator=\"true\">,</mo><msub><mi>σ</mi><mi>i</mi></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">V</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">M</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><msub><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>i</mi></msub><mo separator=\"true\">,</mo><mi>i</mi><mo separator=\"true\">,</mo><msub><mi>π</mi><mi>i</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Verify}(\\mathrm{root}, m, i, \\sigma_i, \\pi_i) =\n\\mathrm{VerifyOTS}(\\mathrm{pk}_i, m, \\sigma_i) \\wedge\n\\mathrm{VerifyMerkle}(\\mathrm{root}, \\mathrm{pk}_i, i, \\pi_i).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Verify</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">m</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">i</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">VerifyOTS</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2175em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">m</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">VerifyMerkle</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2175em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">i</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>The only secret that changes across signatures is the <em>choice of leaf index</em>.</p>\n<h3 id=\"why-one-time-is-an-invariant-not-a-suggestion\" style=\"position:relative;\"><a href=\"#why-one-time-is-an-invariant-not-a-suggestion\" aria-label=\"why one time is an invariant not a suggestion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why “one-time” is an invariant, not a suggestion</h3>\n<p>In WOTS+/LM-OTS-style constructions, the signature leaks structured information about the secret key. The security proof assumes you leak that structure <strong>once</strong>. Twice is a different game.</p>\n<p>Here’s the minimal intuition using a Winternitz-like chain view (XMSS uses WOTS+): <span class=\"citation\" id=\"citation--rfc8391--9\">(<a href=\"#bib-rfc8391\">1</a>)</span></p>\n<p>Let <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>F</mi></mrow><annotation encoding=\"application/x-tex\">F</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span></span></span></span></span> be a one-way function (modeled as a hash). For each chain position <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>j</mi><mo>∈</mo><mo stretchy=\"false\">{</mo><mn>1</mn><mo separator=\"true\">,</mo><mo>…</mo><mo separator=\"true\">,</mo><mi mathvariant=\"normal\">ℓ</mi><mo stretchy=\"false\">}</mo></mrow><annotation encoding=\"application/x-tex\">j \\in \\{1,\\dots,\\ell\\}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.854em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05724em;\">j</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">{</span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"minner\">…</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">ℓ</span><span class=\"mclose\">}</span></span></span></span></span>:</p>\n<ul>\n<li>secret seed: <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>x</mi><mi>j</mi></msub></mrow><annotation encoding=\"application/x-tex\">x_j</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7167em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span></span></span></span></span></li>\n<li>public value: <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>y</mi><mi>j</mi></msub><mo>=</mo><msup><mi>F</mi><mi>w</mi></msup><mo stretchy=\"false\">(</mo><msub><mi>x</mi><mi>j</mi></msub><mo stretchy=\"false\">)</mo></mrow><annotation encoding=\"application/x-tex\">y_j = F^{w}(x_j)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7167em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">y</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.6644em;\"><span style=\"top:-3.063em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02691em;\">w</span></span></span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span></span></span></span></span> for some chain length <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>w</mi></mrow><annotation encoding=\"application/x-tex\">w</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span></span></span></span></span></li>\n</ul>\n<p>For a message <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>m</mi></mrow><annotation encoding=\"application/x-tex\">m</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">m</span></span></span></span></span>, you compute a base-<span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>w</mi></mrow><annotation encoding=\"application/x-tex\">w</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span></span></span></span></span> representation that yields digits <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">{</mo><mn>0</mn><mo separator=\"true\">,</mo><mo>…</mo><mo separator=\"true\">,</mo><mi>w</mi><mo stretchy=\"false\">}</mo></mrow><annotation encoding=\"application/x-tex\">a_j(m) \\in \\{0,\\dots,w\\}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">{</span><span class=\"mord\">0</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"minner\">…</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mclose\">}</span></span></span></span></span>.</p>\n<p>The signature reveals:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mi>j</mi></msub><mo>=</mo><msup><mi>F</mi><mrow><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo></mrow></msup><mo stretchy=\"false\">(</mo><msub><mi>x</mi><mi>j</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_j = F^{a_j(m)}(x_j).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7167em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.2241em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.938em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3281em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2819em;\"><span></span></span></span></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mathnormal mtight\">m</span><span class=\"mclose mtight\">)</span></span></span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>If the same one-time key is used twice for messages <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>m</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>m</mi><mn>2</mn></msub></mrow><annotation encoding=\"application/x-tex\">m_1, m_2</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.625em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span></span></span>, the attacker learns:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msup><mi>F</mi><mrow><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><msub><mi>m</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo></mrow></msup><mo stretchy=\"false\">(</mo><msub><mi>x</mi><mi>j</mi></msub><mo stretchy=\"false\">)</mo><mo separator=\"true\">,</mo><mspace width=\"1em\"></mspace><msup><mi>F</mi><mrow><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><msub><mi>m</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo></mrow></msup><mo stretchy=\"false\">(</mo><msub><mi>x</mi><mi>j</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">F^{a_j(m_1)}(x_j),\\quad F^{a_j(m_2)}(x_j).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.2241em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.938em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3281em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2819em;\"><span></span></span></span></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span><span class=\"mclose mtight\">)</span></span></span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.938em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3281em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2819em;\"><span></span></span></span></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span><span class=\"mclose mtight\">)</span></span></span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Since hashing forward is easy, the attacker can compute:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msup><mi>F</mi><mrow><mi>max</mi><mo>⁡</mo><mo stretchy=\"false\">(</mo><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><msub><mi>m</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo separator=\"true\">,</mo><msub><mi>a</mi><mi>j</mi></msub><mo stretchy=\"false\">(</mo><msub><mi>m</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo stretchy=\"false\">)</mo></mrow></msup><mo stretchy=\"false\">(</mo><msub><mi>x</mi><mi>j</mi></msub><mo stretchy=\"false\">)</mo></mrow><annotation encoding=\"application/x-tex\">F^{\\max(a_j(m_1), a_j(m_2))}(x_j)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.2241em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">F</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.938em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mop mtight\"><span class=\"mtight\">m</span><span class=\"mtight\">a</span><span class=\"mtight\">x</span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3281em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2819em;\"><span></span></span></span></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span><span class=\"mclose mtight\">)</span><span class=\"mpunct mtight\">,</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">a</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3281em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2819em;\"><span></span></span></span></span></span></span><span class=\"mopen mtight\">(</span><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">m</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span><span class=\"mclose mtight\">))</span></span></span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">x</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05724em;\">j</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span></span></span></span></span></div>\n<p>for every chain <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>j</mi></mrow><annotation encoding=\"application/x-tex\">j</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.854em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05724em;\">j</span></span></span></span></span> by hashing forward from the smaller revealed value to the larger. With enough reuse and chosen messages, this becomes a practical forging path.</p>\n<p>You do not need to memorize the exact attack to engineer correctly. You need to internalize the operational conclusion:</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>For XMSS/LMS, a single index reuse is a “stop the world” event. Rotate keys, revoke certificates, and treat all artifacts since the last known-good index as suspect.</p>\n</div>\n<h3 id=\"the-invariant-as-a-formal-predicate\" style=\"position:relative;\"><a href=\"#the-invariant-as-a-formal-predicate\" aria-label=\"the invariant as a formal predicate permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The invariant as a formal predicate</h3>\n<p>Model the signer as a state machine with durable state:</p>\n<ul>\n<li><code class=\"language-text\">next : Nat</code> (the next unused index)</li>\n<li><code class=\"language-text\">used : SUBSET Nat</code> (or, more realistically, an append-only log)</li>\n</ul>\n<p>The deployment invariant is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">N</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">R</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mi mathvariant=\"normal\">.</mi><mtext>  </mtext><mi>i</mi><mo>∈</mo><mrow><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mo>⇒</mo><mi>i</mi><mo>&#x3C;</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>  </mtext><mtext>  </mtext><mo>∧</mo><mtext>  </mtext><mtext>  </mtext><mrow><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mtext> is monotone</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{NoReuse} \\equiv \\forall i.\\; i \\in \\mathrm{used} \\Rightarrow i &#x3C; \\mathrm{next}\\;\\;\\wedge\\;\\;\n\\mathrm{used}\\ \\text{is monotone}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">NoReuse</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7335em;vertical-align:-0.0391em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mord\">.</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">used</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6986em;vertical-align:-0.0391em;\"></span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">&#x3C;</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">next</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">used</span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">is monotone</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>In TLA+-style pseudocode:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">VARIABLES next, used\n\nInit ==\n  /\\ next = 0\n  /\\ used = {}\n\nReserve ==\n  /\\ LET i == next IN\n     /\\ next' = next + 1\n     /\\ used' = used \\cup {i}\n\nInv_NoReuse ==\n  /\\ used \\subseteq 0..(next-1)\n  /\\ used' \\supseteq used</code></pre></div>\n<p>This looks trivial until you map it onto real failures:</p>\n<ul>\n<li><code class=\"language-text\">Reserve</code> must be linearizable across signers.</li>\n<li><code class=\"language-text\">used</code> must be durable across crashes.</li>\n<li>state must not roll back.</li>\n</ul>\n<p>That is where systems engineering starts.</p>\n<h2 id=\"from-proofs-to-binaries-the-implementation-challenge\" style=\"position:relative;\"><a href=\"#from-proofs-to-binaries-the-implementation-challenge\" aria-label=\"from proofs to binaries the implementation challenge permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>From Proofs to Binaries: The Implementation Challenge</h2>\n<p>Formal models talk about “steps”. Your deployment talks about:</p>\n<ul>\n<li>scheduler jitter,</li>\n<li>fsync latency,</li>\n<li>retries under timeouts,</li>\n<li>backups and restores,</li>\n<li>region-level partitions,</li>\n<li>and adversaries who turn those into weapons.</li>\n</ul>\n<h3 id=\"1-concurrency-allocation-must-be-linearizable\" style=\"position:relative;\"><a href=\"#1-concurrency-allocation-must-be-linearizable\" aria-label=\"1 concurrency allocation must be linearizable permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1) Concurrency: allocation must be linearizable</h3>\n<p>If you have more than one signing worker, you need a single source of truth for <code class=\"language-text\">next</code>.</p>\n<p>Correct solutions:</p>\n<ul>\n<li>a dedicated allocator replicated with Raft/Paxos (linearizable log) <span class=\"citation\" id=\"citation--ongaro2014raft--10\">(<a href=\"#bib-ongaro2014raft\">4</a>)</span>,</li>\n<li>an HSM with an internal monotonic counter (if it exists and is trustworthy),</li>\n<li>a single leader signer with strict fencing + durable WAL.</li>\n</ul>\n<p>Incorrect solutions (common in the wild):</p>\n<ul>\n<li>eventually consistent caches,</li>\n<li>“best effort” database updates without serializable semantics,</li>\n<li>“allocate ranges per region” without a global coordination story.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Index reuse is not only a bug. It is an adversary primitive: force retries + partitions + restores until your allocator violates linearizability.</p>\n</div>\n<h3 id=\"2-crash-consistency-durability-must-happen-before-you-return-success\" style=\"position:relative;\"><a href=\"#2-crash-consistency-durability-must-happen-before-you-return-success\" aria-label=\"2 crash consistency durability must happen before you return success permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2) Crash consistency: durability must happen before you return success</h3>\n<p>The hardest bug is:</p>\n<ol>\n<li>signer produces signature <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>σ</mi></mrow><annotation encoding=\"application/x-tex\">\\sigma</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">σ</span></span></span></span></span> for index <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span>,</li>\n<li>process crashes before persisting “i was used”,</li>\n<li>on restart, the signer reuses <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span>.</li>\n</ol>\n<p>The safe pattern is intentionally boring:</p>\n<ul>\n<li><strong>Reserve</strong> index <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span> by appending to durable log and fsync.</li>\n<li><strong>Sign</strong> message using <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>i</mi></mrow><annotation encoding=\"application/x-tex\">i</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6595em;\"></span><span class=\"mord mathnormal\">i</span></span></span></span></span>.</li>\n<li><strong>Record</strong> signature receipt (message hash, artifact id, timestamp, index) for evidence.</li>\n<li>If signing fails mid-flight, <strong>burn</strong> the index anyway.</li>\n</ul>\n<p>Burning indices reduces capacity. Reusing an index destroys security.</p>\n<h3 id=\"3-rollback-attacks-snapshots-are-an-adversary-tool\" style=\"position:relative;\"><a href=\"#3-rollback-attacks-snapshots-are-an-adversary-tool\" aria-label=\"3 rollback attacks snapshots are an adversary tool permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3) Rollback attacks: snapshots are an adversary tool</h3>\n<p>If your signing state lives on disk and you restore an old snapshot, your counter goes backwards. That is equivalent to index reuse.</p>\n<p>Mitigations, in increasing order of strength:</p>\n<ul>\n<li><strong>Detect rollbacks</strong>: remote transparency log of <code class=\"language-text\">(kid, index, artifact-hash)</code>; alert on non-monotone indices.</li>\n<li><strong>Prevent rollbacks</strong>: store the counter in tamper-resistant hardware (TPM monotonic counters, HSM state) — with skepticism about vendor semantics.</li>\n<li><strong>Make rollback irrelevant</strong>: run the allocator as a replicated state machine with quorum persistence; do not restore it from point-in-time backups without a protocol.</li>\n</ul>\n<h3 id=\"4-refinement-mapping-keep-the-spec-to-code-bridge-explicit\" style=\"position:relative;\"><a href=\"#4-refinement-mapping-keep-the-spec-to-code-bridge-explicit\" aria-label=\"4 refinement mapping keep the spec to code bridge explicit permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4) Refinement mapping: keep the spec-to-code bridge explicit</h3>\n<p>The formal model’s state is <code class=\"language-text\">(next, used)</code>. The implementation’s state becomes:</p>\n<ul>\n<li>a WAL segment with committed reservations,</li>\n<li>an allocator term/leader epoch,</li>\n<li>a signer’s local reservation lease,</li>\n<li>and a set of receipts that can be audited.</li>\n</ul>\n<p>Write the refinement mapping down:</p>\n<ul>\n<li><code class=\"language-text\">next</code> ↔ last committed reservation in the allocator log.</li>\n<li><code class=\"language-text\">used</code> ↔ committed reservation set (or ranges) + receipts.</li>\n</ul>\n<p>If you can’t express that mapping, you can’t convincingly argue you implemented the invariant.</p>\n<h3 id=\"implementation-sketch-rust\" style=\"position:relative;\"><a href=\"#implementation-sketch-rust\" aria-label=\"implementation sketch rust permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation sketch (Rust)</h3>\n<p>Treat index allocation as an interface with explicit failure semantics:</p>\n<div class=\"gatsby-code-title\">index_allocator.rs</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">Reservation</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">pub</span> key_id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> start<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> len<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u32</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> epoch<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">,</span> <span class=\"token comment\">// fencing token</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">IndexAllocator</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">reserve</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> key_id<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">str</span><span class=\"token punctuation\">,</span> len<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u32</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token class-name\">Reservation</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">AllocError</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">commit_receipt</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> receipt<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Receipt</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">AllocError</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>The invariants the implementation must preserve are not “Rust safety” invariants. They are protocol invariants:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">{ Linearizable(next) * DurableLog(kid) }\nreserve(kid, len)\n{ Disjoint(reservation, prior) ∧ Monotone(next) }</code></pre></div>\n<p>If you cannot test linearizability under adversarial schedules, you are guessing. Use deterministic concurrency testing where possible (e.g., Loom for the local state machine) and fault-injection for the allocator boundary.</p>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<p>This is incident response, not wishful thinking. If you don’t rehearse it, you don’t have it.</p>\n<ul>\n<li><strong>Trigger:</strong> any evidence of index reuse, rollback, or allocator split-brain.</li>\n<li><strong>Immediate action:</strong> stop signing; quarantine signing workers; preserve disks/logs for forensics.</li>\n<li><strong>Containment:</strong> rotate signing key; revoke code-signing certificate; publish incident notice if artifacts shipped.</li>\n<li><strong>Recovery:</strong> re-issue artifacts signed under new key; enforce monotonic counter storage or RSM allocator before resuming.</li>\n<li><strong>Postmortem:</strong> add a forced test that reproduces the failure (snapshot restore + retry storm + crash at worst point).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8554\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8554: LMS/HSS</a> <span class=\"citation\" id=\"citation--rfc8554--11\">(<a href=\"#bib-rfc8554\">2</a>)</span>\n<ul>\n<li><strong>Evidence (spec constraint):</strong> “An LM-OTS private key MUST NOT be used to sign more than one message.”</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8391\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8391: XMSS</a> <span class=\"citation\" id=\"citation--rfc8391--12\">(<a href=\"#bib-rfc8391\">1</a>)</span>\n<ul>\n<li><strong>Evidence (deployment reality):</strong> the security story explicitly assumes one-time use of WOTS+ keys.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/pubs/sp/800/208/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-208</a> <span class=\"citation\" id=\"citation--nistsp800208--13\">(<a href=\"#bib-nistsp800208\">3</a>)</span>\n<ul>\n<li><strong>Evidence (operationalization):</strong> stateful signature schemes require secure state management; rollback is a first-class hazard.</li>\n</ul>\n</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Raft</a> <span class=\"citation\" id=\"citation--ongaro2014raft--14\">(<a href=\"#bib-ongaro2014raft\">4</a>)</span>\n<ul>\n<li><strong>Evidence (engineering pattern):</strong> linearizable replicated logs are the standard way to enforce “exactly-once allocation” under failures.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your hard boundary: “prevent rollback” or “detect rollback and rotate”?</li>\n<li>Can you justify a single-region allocator for your threat model, or do you need cross-region quorum?</li>\n<li>What is your evidence story: can you prove non-reuse to an auditor after an incident?</li>\n<li>If the allocator is compromised, what are your containment mechanisms (fencing, transparency, revocation)?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> <code class=\"language-text\">NoReuse</code> invariant is written as code + tests, not a wiki sentence.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Allocation is linearizable across signers (not “usually correct”).</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Reservations are durable before success is returned (fsync/WAL semantics).</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Snapshot/backup restore cannot rewind state without detection/rotation.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Duplicate detection pages immediately and blocks signing.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Key rotation + certificate revocation playbook is rehearsed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8391\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8391: XMSS</a> — The XMSS standard; read it with an “index reuse” lens. <span class=\"citation\" id=\"citation--rfc8391--15\">(<a href=\"#bib-rfc8391\">1</a>)</span></li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8554\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8554: LMS/HSS</a> — LMS/HSS standard and constraints. <span class=\"citation\" id=\"citation--rfc8554--16\">(<a href=\"#bib-rfc8554\">2</a>)</span></li>\n<li><a href=\"https://csrc.nist.gov/pubs/sp/800/208/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-208</a> — NIST’s recommendation for LMS/XMSS deployments. <span class=\"citation\" id=\"citation--nistsp800208--17\">(<a href=\"#bib-nistsp800208\">3</a>)</span></li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">HKDF (RFC 5869)</a> — Useful when binding receipts and deriving per-artifact keys from signing state. <span class=\"citation\" id=\"citation--rfc5869--18\">(<a href=\"#bib-rfc5869\">5</a>)</span></li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — If you operate distributed allocators, you need adversarial testing discipline. <span class=\"citation\" id=\"citation--jepsen--19\">(<a href=\"#bib-jepsen\">6</a>)</span></li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8391\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Huelsing A, Butin D, Gazdag S, Rijneveld J, Mohaisen A. XMSS: eXtended Merkle Signature Scheme [Internet]. RFC Editor; 2018. Report No.: 8391. Available from: https://www.rfc-editor.org/rfc/rfc8391</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc8554\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">McGrew D, Curcio M, Fluhrer S. Leighton-Micali Hash-Based Signatures [Internet]. RFC Editor; 2019. Report No.: 8554. Available from: https://www.rfc-editor.org/rfc/rfc8554</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistsp800208\">\n    <div class=\"csl-left-margin\">3. </div><div class=\"csl-right-inline\">Cooper DA, Apon DC, Dang QH, Davidson MS, Dworkin MJ, Miller CA. Recommendation for Stateful Hash-Based Signature Schemes [Internet]. 2020. Report No.: 800–208. Available from: https://csrc.nist.gov/pubs/sp/800/208/final</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-ongaro2014raft\">\n    <div class=\"csl-left-margin\">4. </div><div class=\"csl-right-inline\">Ongaro D, Ousterhout J. In Search of an Understandable Consensus Algorithm (Raft). In: 2014 USENIX Annual Technical Conference (USENIX ATC 14) [Internet]. 2014. Available from: https://raft.github.io/raft.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">5. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">6. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2026-04-stateful-signatures-xmss-lms-without-index-reuse",
            "title": "Stateful Signatures Are a Distributed Systems Problem: XMSS/LMS Without Index Reuse",
            "summary": "Deep dive (April 2026): stateful hash-based signatures look like “just PQC”, but one index reuse is a catastrophic key-management failure. Model the invariant, then build the allocator like a consensus component.",
            "date_modified": "2026-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security-critical-infrastructure",
                "devsecops",
                "iiot-platforms",
                "distributed-systems",
                "formal-methods"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2026-03-hotstuff-termination-uc-delay-attacks",
            "content_html": "<blockquote>\n<p>Paper-driven research note. Theme: <strong>Termination proofs for industrial BFT</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>In critical infrastructure, “consensus safety” is table stakes. The incident is almost never “two conflicting commits”; the incident is <strong>the protocol that stops making progress</strong> while operators stare at dashboards and timeouts that look “reasonable” on paper. This post dissects a recent UC-flavored termination proof for HotStuff and turns it into engineering constraints you can actually ship — in Rust, under adversarial latency, with cryptography whose parameters are not free.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p><strong>Termination is an interface contract.</strong> If you cannot bound “time-to-finality under attack” as a function of network + compute, you do not have a reliable protocol — you have a hope with a quorum.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li><strong>Liveness is where production fails.</strong> Partial synchrony + bad timeout discipline yields “correct” protocols that don’t terminate.</li>\n<li><strong>The invariant is not “3-chain commits”.</strong> The invariant you actually ride is a monotone lock/highQC discipline that constrains future votes.</li>\n<li><strong>Exponential backoff is not a UX tweak.</strong> It is a <strong>liveness proof technique</strong> against delay attacks, but it changes your operational envelope.</li>\n<li><strong>UC proofs are not deployment proofs.</strong> They abstract away CPU, queues, scheduler jitter, and memory pressure — the things that dominate IIoT and real fleets.</li>\n<li><strong>Cryptographic parameters affect termination.</strong> If signature verification time becomes part of <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span>, your liveness bound moves. Post-quantum migration makes this painfully explicit.</li>\n</ul>\n<h2 id=\"introduction-pragmatic-abstract-why-you-should-care-today\" style=\"position:relative;\"><a href=\"#introduction-pragmatic-abstract-why-you-should-care-today\" aria-label=\"introduction pragmatic abstract why you should care today permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction (Pragmatic abstract: why you should care today)</h2>\n<p>It’s 03:17 in Santiago. A consortium chain is “healthy” in the sense that nodes are alive, disks are fine, and TLS handshakes still work. But finality stalls. The pager doesn’t ask whether the protocol is Byzantine-safe. It asks a simpler question:</p>\n<blockquote>\n<p>“Can you commit within a bounded time under adversarial latency?”</p>\n</blockquote>\n<p>This is not academic. Any system that uses BFT consensus as an availability primitive — identity registries, payment rails, device authorization, industrial telemetry notarization — eventually meets the same failure mode: <strong>network delay attacks</strong> and correlated jitter that keep honest replicas oscillating in view changes.</p>\n<p>The paper I’m using as the anchor is:</p>\n<ul>\n<li>“On the Termination of the HotStuff Protocol Within the Universally Composable Framework” (IACR ePrint 2025/1560). <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--1\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></li>\n</ul>\n<p>Their claim is specific and valuable: build a UC-style formal system for HotStuff in a partially synchronous network and prove <strong>termination</strong> (progress) even under delay attacks using <strong>phased time analysis</strong> and <strong>exponential backoff</strong>. This matters because HotStuff has become the default “industrial BFT shape” precisely due to its linear view change and pipelining. <span class=\"citation\" id=\"citation--yin2019hotstuff--2\">(<a href=\"#bib-yin2019hotstuff\">2</a>)</span></p>\n<p>But “valuable” is not “sufficient”. We need to translate the proof into constraints that survive:</p>\n<ul>\n<li>lossy networks,</li>\n<li>asymmetric compute (heterogeneous nodes),</li>\n<li>real cryptography (and post-quantum parameter sets),</li>\n<li>real Rust concurrency,</li>\n<li>and adversaries who attack queues, timeouts, and operators.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Delay attacks don’t need to break signatures. They break <em>coordination</em>: by keeping timeouts too small and views too unstable, they turn “safety” into “permanent limbo”.</p>\n</div>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<p>I’m explicit here because “unstated assumptions” are where correctness dies in production.</p>\n<ul>\n<li><strong>Partial synchrony</strong>: there exists a Global Stabilization Time (GST) after which message delays are bounded by <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> (unknown a priori). <span class=\"citation\" id=\"citation--dls1988partialsynchrony--3\">(<a href=\"#bib-dls1988partialsynchrony\">3</a>)</span></li>\n<li><strong>Fault model</strong>: <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>n</mi><mo>=</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">n=3f+1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> replicas, up to <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>f</mi></mrow><annotation encoding=\"application/x-tex\">f</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span></span></span></span></span> Byzantine; quorum size <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>2</mn><mi>f</mi><mo>+</mo><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">2f+1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span>.</li>\n<li><strong>Cryptography</strong>: signatures are unforgeable; adversary cannot forge QC proofs without corrupting quorum. (UC frameworks typically idealize this; see critique later.) <span class=\"citation\" id=\"citation--canetti2001uc--4\">(<a href=\"#bib-canetti2001uc\">4</a>)</span></li>\n<li><strong>Clocks/timeouts</strong>: replicas can measure timeouts locally with bounded drift; timeout expiration is reliable enough to be a protocol input.</li>\n<li><strong>Scheduler fairness (weak)</strong>: a replica that is “ready to act” is eventually scheduled (no permanent CPU starvation).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving performance. Termination is about <strong>eventual progress</strong> and bounds; throughput is a different beast.</li>\n<li>Modeling the full cryptographic stack (TLS, KMS, enclaves). We treat those as deployment layers with their own threat models.</li>\n<li>Solving adversarial network routing. We handle delay/jitter within the partial synchrony envelope — not BGP-level warfare.</li>\n</ul>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<p>I separate “consensus safety” from “termination” because conflating them is how teams ship protocol code that passes tests and fails reality.</p>\n<h3 id=\"safety-agreement--consistency\" style=\"position:relative;\"><a href=\"#safety-agreement--consistency\" aria-label=\"safety agreement  consistency permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Safety (agreement / consistency)</h3>\n<p>Informally: no two honest replicas commit conflicting blocks.</p>\n<p>Formally, for committed blocks <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>b</mi></mrow><annotation encoding=\"application/x-tex\">b</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\">b</span></span></span></span></span> and <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msup><mi>b</mi><mo mathvariant=\"normal\" lspace=\"0em\" rspace=\"0em\">′</mo></msup></mrow><annotation encoding=\"application/x-tex\">b'</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7519em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">b</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.7519em;\"><span style=\"top:-3.063em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">′</span></span></span></span></span></span></span></span></span></span></span></span></span> at the same height:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">□</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.8em\" maxsize=\"1.8em\">(</mo><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mo stretchy=\"false\">(</mo><mi>b</mi><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mo stretchy=\"false\">(</mo><msup><mi>b</mi><mo mathvariant=\"normal\" lspace=\"0em\" rspace=\"0em\">′</mo></msup><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi>b</mi><mo>⪯</mo><msup><mi>b</mi><mo mathvariant=\"normal\" lspace=\"0em\" rspace=\"0em\">′</mo></msup><mo>∨</mo><msup><mi>b</mi><mo mathvariant=\"normal\" lspace=\"0em\" rspace=\"0em\">′</mo></msup><mo>⪯</mo><mi>b</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.8em\" maxsize=\"1.8em\">)</mo></mrow><annotation encoding=\"application/x-tex\">\\Box\\Big(\\mathrm{Committed}(b)\\wedge \\mathrm{Committed}(b') \\Rightarrow b \\preceq b' \\vee b' \\preceq b\\Big)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.8em;vertical-align:-0.65em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mord\"><span class=\"delimsizing size2\">(</span></span><span class=\"mord\"><span class=\"mord mathrm\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">b</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0519em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">b</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8019em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">′</span></span></span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8304em;vertical-align:-0.136em;\"></span><span class=\"mord mathnormal\">b</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8019em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">b</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8019em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">′</span></span></span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.9379em;vertical-align:-0.136em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">b</span><span class=\"msupsub\"><span class=\"vlist-t\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8019em;\"><span style=\"top:-3.113em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">′</span></span></span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.8em;vertical-align:-0.65em;\"></span><span class=\"mord mathnormal\">b</span><span class=\"mord\"><span class=\"delimsizing size2\">)</span></span></span></span></span></span></div>\n<p>where <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mo>⪯</mo></mrow><annotation encoding=\"application/x-tex\">\\preceq</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.7719em;vertical-align:-0.136em;\"></span><span class=\"mrel\">⪯</span></span></span></span></span> is the ancestor relation in the block tree (chain prefix).</p>\n<h3 id=\"liveness--termination\" style=\"position:relative;\"><a href=\"#liveness--termination\" aria-label=\"liveness  termination permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Liveness / termination</h3>\n<p>We want: after GST, honest replicas commit within bounded time.</p>\n<p>In a partial synchrony model, the best you can do is: <strong>there exists a bound</strong> <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>T</mi><mo stretchy=\"false\">(</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mtext>compute</mtext><mo separator=\"true\">,</mo><mi>f</mi><mo separator=\"true\">,</mo><mi>n</mi><mo stretchy=\"false\">)</mo></mrow><annotation encoding=\"application/x-tex\">T(\\Delta, \\text{compute}, f, n)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"mopen\">(</span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">compute</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">n</span><span class=\"mclose\">)</span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi mathvariant=\"normal\">◊</mi><mrow><mo>≤</mo><mi>T</mi></mrow></msub><mtext>  </mtext><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mo stretchy=\"false\">(</mo><mo>⋅</mo><mo stretchy=\"false\">)</mo></mrow><annotation encoding=\"application/x-tex\">\\Diamond_{\\le T}\\;\\mathrm{Committed}(\\cdot)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord amsrm\">◊</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mrel mtight\">≤</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.13889em;\">T</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2452em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord\">⋅</span><span class=\"mclose\">)</span></span></span></span></span></div>\n<p>In UC terms: you define an ideal functionality that “decides” (terminates) and then prove the real protocol <strong>UC-realizes</strong> it, meaning no environment can distinguish real execution from ideal execution (up to negligible probability) while preserving the termination guarantee. <span class=\"citation\" id=\"citation--canetti2001uc--5\">(<a href=\"#bib-canetti2001uc\">4</a>)</span> <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--6\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></p>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<p>If you’ve operated these systems, none of these are hypothetical.</p>\n<ul>\n<li><strong>Timeout thrashing</strong>: views advance faster than information propagates; no leader gathers a QC.</li>\n<li><strong>Compute-induced delay</strong>: signature verification and state execution inflate the effective <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span>; timeouts are tuned for “network”, but the bottleneck is CPU.</li>\n<li><strong>Queue collapse</strong>: inbound gossip queues saturate; critical messages get delayed behind garbage (or behind retransmits).</li>\n<li><strong>Partial rollout</strong>: mixed versions interpret timeout rules differently → liveness regression without safety violation.</li>\n<li><strong>“Safe but stuck” by design</strong>: lock rules prevent voting for anything that would make progress under certain leader schedules.</li>\n<li><strong>Backoff runaway</strong>: exponential backoff restores liveness but pushes time-to-finality into operationally unacceptable territory during sustained jitter.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>If you tune timeouts using “median RTT”, you are tuning for the world where nobody is trying to break you. The liveness proof needs <strong>worst-case</strong> envelopes after GST.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<p>If you can’t observe the proof obligations, you can’t operate the system.</p>\n<ul>\n<li><strong>View-change rate</strong> and distribution (p50/p99). Spikes are the first symptom of a delay attack.</li>\n<li><strong>Leader success probability</strong> per epoch: fraction of views producing a QC/commit.</li>\n<li><strong>QC propagation lag</strong>: time from QC formation to the last honest replica updating <code class=\"language-text\">highQC</code>.</li>\n<li><strong>Timeout growth curve</strong>: backoff state per replica; divergence indicates split-brain on liveness inputs.</li>\n<li><strong>Signature verification latency</strong> (and batch sizes): crypto cost is part of <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> in practice.</li>\n<li><strong>Queue depth / drop rate</strong> on consensus channels (propose/vote/new-view): liveness dies in queues.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<p>If termination is part of your SLO, rollback is part of the protocol story.</p>\n<ul>\n<li><strong>Feature-flag backoff policy</strong>: ability to revert timeout/backoff changes without redeploying binaries.</li>\n<li><strong>Safe-mode</strong>: temporarily disable pipelining (reduce concurrency) to stabilize liveness during incident response.</li>\n<li><strong>Config rollback</strong>: deterministic config snapshot + config hash in logs to prevent “unknown timeout drift”.</li>\n<li><strong>Protocol downgrade gate</strong>: only allow rollback between epoch boundaries to avoid mixed rules within a view.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Carry liveness parameters as signed config artifacts. When the chain stalls, you need evidence of what timeout schedule each node is actually running.</p>\n</div>\n<h2 id=\"the-mathematical-anatomy-of-the-problem\" style=\"position:relative;\"><a href=\"#the-mathematical-anatomy-of-the-problem\" aria-label=\"the mathematical anatomy of the problem permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Mathematical Anatomy of the Problem</h2>\n<p>HotStuff’s safety intuition is familiar: vote only for safe extensions of what you know; commit when you have a certified chain. The subtlety is termination: after GST, you need the protocol to stop spinning.</p>\n<p>To talk precisely, we need a minimal state model.</p>\n<h3 id=\"state-and-events\" style=\"position:relative;\"><a href=\"#state-and-events\" aria-label=\"state and events permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>State and events</h3>\n<p>Let:</p>\n<ul>\n<li><code class=\"language-text\">view ∈ Nat</code> be the current view number.</li>\n<li><code class=\"language-text\">leader(view)</code> be the designated leader.</li>\n<li><code class=\"language-text\">highQC</code> be the highest known quorum certificate (QC) by view number.</li>\n<li><code class=\"language-text\">lockedQC</code> be the QC that constrains votes (“lock”).</li>\n<li><code class=\"language-text\">timeout(view)</code> be the local timeout budget for the current view.</li>\n<li><code class=\"language-text\">Blocks</code> be a tree with parent pointers; each block has <code class=\"language-text\">(parent, view, payload, qc?)</code>.</li>\n</ul>\n<p>Events:</p>\n<ul>\n<li><code class=\"language-text\">Propose(b)</code> by leader.</li>\n<li><code class=\"language-text\">Vote(b)</code> by replicas.</li>\n<li><code class=\"language-text\">NewView(view, highQC)</code> messages.</li>\n<li><code class=\"language-text\">Timeout(view)</code> local expiration.</li>\n</ul>\n<p>In TLA+ style, the transition system is:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">VARIABLES view, highQC, lockedQC, blocks, decided, timeout\n\nInit ==\n  /\\ view = 0\n  /\\ decided = FALSE\n  /\\ highQC = GenesisQC\n  /\\ lockedQC = GenesisQC\n  /\\ blocks = {Genesis}\n  /\\ timeout = T0\n\nNext ==\n  \\/ ProposeStep\n  \\/ VoteStep\n  \\/ QCStep\n  \\/ CommitStep\n  \\/ TimeoutStep\n  \\/ NewViewStep</code></pre></div>\n<p>This is intentionally incomplete — the point is to isolate the core proof obligations.</p>\n<h3 id=\"the-invariant-that-actually-matters-monotone-lock-discipline\" style=\"position:relative;\"><a href=\"#the-invariant-that-actually-matters-monotone-lock-discipline\" aria-label=\"the invariant that actually matters monotone lock discipline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The invariant that actually matters: monotone lock discipline</h3>\n<p>HotStuff safety is usually explained via “3-chain commit” (a block is committed when it has a chain of descendants with QCs). But safety is <em>enforced</em> by a more operational invariant: honest replicas do not vote in ways that can later create conflicting commits.</p>\n<p>One useful invariant (informal but precise enough to mechanize) is:</p>\n<blockquote>\n<p><strong>Lock invariant</strong>: An honest replica votes only for blocks that extend its <code class=\"language-text\">lockedQC</code> (or a QC with view ≥ the lock), and <code class=\"language-text\">lockedQC.view</code> is monotone non-decreasing.</p>\n</blockquote>\n<p>Formally:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mrow><mi>l</mi><mi>o</mi><mi>c</mi><mi>k</mi></mrow></msub><mo>≡</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>∈</mo><mi>H</mi><mo>:</mo><mtext>  </mtext><mtext>  </mtext><msub><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi></msub><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mo>≤</mo><msub><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi></msub><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mtext>  </mtext><mo>∧</mo><mtext>  </mtext><mi mathvariant=\"normal\">□</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.2em\" maxsize=\"1.2em\">(</mo><msubsup><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi><mo mathvariant=\"normal\" lspace=\"0em\" rspace=\"0em\">′</mo></msubsup><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mo>≥</mo><msub><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi></msub><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.2em\" maxsize=\"1.2em\">)</mo></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}_{lock} \\equiv \\forall r\\in H:\\;\\; \\mathrm{lockedQC}_r.view \\le \\mathrm{highQC}_r.view\n\\;\\wedge\\;\n\\Box\\big(\\mathrm{lockedQC}'_r.view \\ge \\mathrm{lockedQC}_r.view\\big)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.01968em;\">l</span><span class=\"mord mathnormal mtight\">oc</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7335em;vertical-align:-0.0391em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.9386em;vertical-align:-0.2441em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">lockedQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.9386em;vertical-align:-0.2441em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">highQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.2em;vertical-align:-0.35em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mord\"><span class=\"delimsizing size1\">(</span></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">lockedQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.8362em;\"><span style=\"top:-2.453em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span><span style=\"top:-3.1473em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">′</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.247em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.2em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">lockedQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mord\"><span class=\"delimsizing size1\">)</span></span></span></span></span></span></div>\n<p>and vote safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">□</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.8em\" maxsize=\"1.8em\">(</mo><msub><mrow><mi mathvariant=\"normal\">V</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi></mrow><mi>r</mi></msub><mo stretchy=\"false\">(</mo><mi>b</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>b</mi><mo separator=\"true\">,</mo><msub><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∨</mo><mtext> </mtext><mi>b</mi><mi mathvariant=\"normal\">.</mi><mi>q</mi><mi>c</mi><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mo>≥</mo><msub><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">Q</mi><mi mathvariant=\"normal\">C</mi></mrow><mi>r</mi></msub><mi mathvariant=\"normal\">.</mi><mi>v</mi><mi>i</mi><mi>e</mi><mi>w</mi><mo fence=\"false\" stretchy=\"true\" minsize=\"1.8em\" maxsize=\"1.8em\">)</mo></mrow><annotation encoding=\"application/x-tex\">\\Box\\Big(\\mathrm{Vote}_r(b)\\Rightarrow \\mathrm{Extends}(b,\\mathrm{lockedQC}_r)\\ \\vee\\ b.qc.view \\ge \\mathrm{lockedQC}_r.view\\Big)</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.8em;vertical-align:-0.65em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mord\"><span class=\"delimsizing size2\">(</span></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Vote</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">b</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Extends</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">b</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">lockedQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\">b</span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">q</span><span class=\"mord mathnormal\">c</span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.8em;vertical-align:-0.65em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">lockedQC</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"mord mathnormal\">i</span><span class=\"mord mathnormal\">e</span><span class=\"mord mathnormal\" style=\"margin-right:0.02691em;\">w</span><span class=\"mord\"><span class=\"delimsizing size2\">)</span></span></span></span></span></span></div>\n<p>where <code class=\"language-text\">Extends(b, qc)</code> means <code class=\"language-text\">b</code> is in the subtree rooted at the block certified by <code class=\"language-text\">qc</code>.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p><strong>Monotone locks + safe-vote rule</strong> are the core safety rail. Everything else (pipelining, leader rotation) has to respect this or the proof collapses.</p>\n</div>\n<h3 id=\"termination-why-delay-attacks-break-naive-liveness\" style=\"position:relative;\"><a href=\"#termination-why-delay-attacks-break-naive-liveness\" aria-label=\"termination why delay attacks break naive liveness permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Termination: why delay attacks break naive liveness</h3>\n<p>Under partial synchrony, termination proofs typically take this shape:</p>\n<ol>\n<li>After GST, message delay ≤ <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span>.</li>\n<li>If the protocol ever enters a “stable” view whose timeout ≥ <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>k</mi><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">k\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mord\">Δ</span></span></span></span></span> (for some constant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>k</mi></mrow><annotation encoding=\"application/x-tex\">k</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span></span></span></span></span>), the leader can complete a round: propose → collect votes → form QC → advance.</li>\n<li>Therefore, show that the protocol will <em>eventually</em> reach such a stable view.</li>\n</ol>\n<p>Delay attacks break step (3) by ensuring timeouts stay too small: replicas time out before QCs propagate, triggering perpetual view changes.</p>\n<p>The paper’s core move is to treat timeout selection not as configuration but as a <strong>proof object</strong>: a phased time analysis with exponential backoff so that, after enough failed phases, some honest views have timeout large enough to dominate <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> and finish. <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--7\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></p>\n<h3 id=\"a-backoff-lemma-the-engineering-version\" style=\"position:relative;\"><a href=\"#a-backoff-lemma-the-engineering-version\" aria-label=\"a backoff lemma the engineering version permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>A backoff lemma (the engineering version)</h3>\n<p>Assume the local timeout evolves as:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>T</mi><mrow><mi>i</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mn>2</mn><msub><mi>T</mi><mi>i</mi></msub><mspace width=\"1em\"></mspace><mtext>on view-change due to timeout.</mtext></mrow><annotation encoding=\"application/x-tex\">T_{i+1} = 2T_i \\quad\\text{on view-change due to timeout.}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8917em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">i</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">on view-change due to timeout.</span></span></span></span></span></span></div>\n<p>Let <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>k</mi></mrow><annotation encoding=\"application/x-tex\">k</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span></span></span></span></span> be the first phase where <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><msub><mi>T</mi><mi>k</mi></msub><mo>≥</mo><mi>c</mi><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">T_k \\ge c\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\">c</span><span class=\"mord\">Δ</span></span></span></span></span> (for a constant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span> that hides protocol steps and crypto verification latency). Then:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>k</mi><mo>=</mo><mrow><mo fence=\"true\">⌈</mo><msub><mrow><mi>log</mi><mo>⁡</mo></mrow><mn>2</mn></msub><mfrac><mrow><mi>c</mi><mi mathvariant=\"normal\">Δ</mi></mrow><msub><mi>T</mi><mn>0</mn></msub></mfrac><mo fence=\"true\">⌉</mo></mrow></mrow><annotation encoding=\"application/x-tex\">k = \\left\\lceil \\log_2 \\frac{c\\Delta}{T_0} \\right\\rceil</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.4em;vertical-align:-0.95em;\"></span><span class=\"minner\"><span class=\"mopen delimcenter\" style=\"top:0em;\"><span class=\"delimsizing size3\">⌈</span></span><span class=\"mop\"><span class=\"mop\">lo<span style=\"margin-right:0.01389em;\">g</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.207em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.3603em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">0</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">c</span><span class=\"mord\">Δ</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.836em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mclose delimcenter\" style=\"top:0em;\"><span class=\"delimsizing size3\">⌉</span></span></span></span></span></span></span></div>\n<p>and the total time spent until entering that phase is bounded by the geometric series:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><munderover><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>0</mn></mrow><mi>k</mi></munderover><msub><mi>T</mi><mi>i</mi></msub><mo>≤</mo><mn>2</mn><msub><mi>T</mi><mi>k</mi></msub><mo>≤</mo><mn>2</mn><mi>c</mi><mi mathvariant=\"normal\">Δ</mi><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\sum_{i=0}^{k} T_i \\le 2T_k \\le 2c\\Delta.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:3.1138em;vertical-align:-1.2777em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.8361em;\"><span style=\"top:-1.8723em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">i</span><span class=\"mrel mtight\">=</span><span class=\"mord mtight\">0</span></span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span><span style=\"top:-4.3em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.2777em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3117em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\">2</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\">c</span><span class=\"mord\">Δ.</span></span></span></span></span></div>\n<p>This is the skeleton behind “bounded termination under delay attacks”: backoff converts unknown <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> into a bounded search cost.</p>\n<p>The uncomfortable part is hidden in <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span>: in real code, <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span> is not “3” — it includes:</p>\n<ul>\n<li>signature verification budget,</li>\n<li>message batching and queueing,</li>\n<li>state execution time,</li>\n<li>and scheduler jitter.</li>\n</ul>\n<p>If your implementation inflates <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span>, your termination bound inflates even if the proof is correct.</p>\n<h3 id=\"uc-angle-refinement-mapping-not-just-an-invariant\" style=\"position:relative;\"><a href=\"#uc-angle-refinement-mapping-not-just-an-invariant\" aria-label=\"uc angle refinement mapping not just an invariant permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>UC angle: refinement mapping, not just an invariant</h3>\n<p>UC proofs are not “prove an invariant and you’re done”. You define an ideal functionality <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"script\">F</mi></mrow><annotation encoding=\"application/x-tex\">\\mathcal{F}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathcal\" style=\"margin-right:0.09931em;\">F</span></span></span></span></span> that captures the desired behavior, then show the real protocol <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Π</mi></mrow><annotation encoding=\"application/x-tex\">\\Pi</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Π</span></span></span></span></span> emulates it in any environment.</p>\n<p>The useful mental model for engineers is a refinement mapping:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>ρ</mi><mo>:</mo><msub><mi>S</mi><mi mathvariant=\"normal\">Π</mi></msub><mo>→</mo><msub><mi>S</mi><mi mathvariant=\"script\">F</mi></msub></mrow><annotation encoding=\"application/x-tex\">\\rho : S_{\\Pi} \\to S_{\\mathcal{F}}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.625em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\">ρ</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">Π</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">→</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathcal mtight\" style=\"margin-right:0.09931em;\">F</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span></span></span></span></span></div>\n<p>mapping concrete protocol state (blocks, QCs, views, transcripts) into an abstract state (decided value, delivered-to-who).</p>\n<p>An engineer-friendly mapping for HotStuff is:</p>\n<ul>\n<li><span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>ρ</mi><mo stretchy=\"false\">(</mo><mi>s</mi><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi><mrow><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">V</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>=</mo></mrow><annotation encoding=\"application/x-tex\">\\rho(s).\\mathrm{decidedValue} =</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\">ρ</span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mclose\">)</span><span class=\"mord\">.</span><span class=\"mord\"><span class=\"mord mathrm\">decidedValue</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span></span></span></span></span> payload of the first committed block,</li>\n<li><span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>ρ</mi><mo stretchy=\"false\">(</mo><mi>s</mi><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi><mrow><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">d</mi></mrow><mo stretchy=\"false\">(</mo><mi>r</mi><mo stretchy=\"false\">)</mo><mo>=</mo></mrow><annotation encoding=\"application/x-tex\">\\rho(s).\\mathrm{delivered}(r) =</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\">ρ</span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mclose\">)</span><span class=\"mord\">.</span><span class=\"mord\"><span class=\"mord mathrm\">delivered</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span></span></span></span></span> whether replica <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>r</mi></mrow><annotation encoding=\"application/x-tex\">r</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span></span></span></span></span> has observed commit proof,</li>\n<li><span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>ρ</mi><mo stretchy=\"false\">(</mo><mi>s</mi><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>=</mo></mrow><annotation encoding=\"application/x-tex\">\\rho(s).\\mathrm{time} =</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\">ρ</span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mclose\">)</span><span class=\"mord\">.</span><span class=\"mord\"><span class=\"mord mathrm\">time</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span></span></span></span></span> logical time since GST (or since some start).</li>\n</ul>\n<p>Then you prove:</p>\n<ol>\n<li><strong>Safety refinement</strong>: concrete commits map to a single decided value in <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"script\">F</mi></mrow><annotation encoding=\"application/x-tex\">\\mathcal{F}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathcal\" style=\"margin-right:0.09931em;\">F</span></span></span></span></span>.</li>\n<li><strong>Liveness refinement</strong>: if <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"script\">F</mi></mrow><annotation encoding=\"application/x-tex\">\\mathcal{F}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathcal\" style=\"margin-right:0.09931em;\">F</span></span></span></span></span> terminates within bound <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>T</mi></mrow><annotation encoding=\"application/x-tex\">T</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span></span></span></span></span>, so does <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Π</mi></mrow><annotation encoding=\"application/x-tex\">\\Pi</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Π</span></span></span></span></span> (under assumptions).</li>\n</ol>\n<p>The paper frames this through UC indistinguishability; the refinement mapping is the bridge engineers can actually use to align spec ↔ code. <span class=\"citation\" id=\"citation--canetti2001uc--8\">(<a href=\"#bib-canetti2001uc\">4</a>)</span> <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--9\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">RefinementSafety ==\n  /\\ decided => \\E v : Ideal.decidedValue = Payload(CommittedBlock)\n\nRefinementLiveness ==\n  /\\ AfterGST => &#x3C;>_&#x3C;=T decided</code></pre></div>\n<p>No, this is not a complete proof. It is the scaffold you need before you drown in details.</p>\n<h2 id=\"from-proofs-to-binaries-the-implementation-challenge\" style=\"position:relative;\"><a href=\"#from-proofs-to-binaries-the-implementation-challenge\" aria-label=\"from proofs to binaries the implementation challenge permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>From Proofs to Binaries: The Implementation Challenge</h2>\n<p>Formal models talk about messages, not memory. They talk about “steps”, not cache misses. They talk about “timeouts”, not <code class=\"language-text\">tokio::time::sleep()</code> under load.</p>\n<p>This is where high-assurance work lives: the gap.</p>\n<h3 id=\"1-concurrency-and-determinism-dont-let-the-runtime-invent-new-behaviors\" style=\"position:relative;\"><a href=\"#1-concurrency-and-determinism-dont-let-the-runtime-invent-new-behaviors\" aria-label=\"1 concurrency and determinism dont let the runtime invent new behaviors permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1) Concurrency and determinism: don’t let the runtime invent new behaviors</h3>\n<p>If your replica is implemented as a set of concurrent tasks (network IO, timer, consensus state machine), your correctness story depends on <em>how events interleave</em>.</p>\n<p>In Rust, “memory safe” is not “protocol correct”. You need an explicit concurrency model:</p>\n<ul>\n<li>single-threaded event loop per replica (deterministic state transitions), or</li>\n<li>carefully designed shared state with a proof story.</li>\n</ul>\n<p>In separation logic terms, you want to preserve ownership and invariants across event handlers:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">{ Tree(blocks) * LockState(highQC, lockedQC) * Timer(view, timeout) }\nhandle(event)\n{ Tree(blocks') * LockState(highQC', lockedQC') * Timer(view', timeout')  ∧ Inv_lock }</code></pre></div>\n<p>The practical trick: <strong>make the protocol state single-owner</strong>. Use channels to serialize transitions; treat networking and timers as producers of events, not mutators of state.</p>\n<h3 id=\"2-delta-includes-crypto-post-quantum-parameters-move-your-liveness-bound\" style=\"position:relative;\"><a href=\"#2-delta-includes-crypto-post-quantum-parameters-move-your-liveness-bound\" aria-label=\"2 delta includes crypto post quantum parameters move your liveness bound permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2) “<span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> includes crypto”: post-quantum parameters move your liveness bound</h3>\n<p>HotStuff deployments often rely on threshold signatures (e.g., BLS) to compress votes/QCs. In UC proofs, signatures are ideal: verification is a constant-time oracle.</p>\n<p>In reality:</p>\n<ul>\n<li>verification time is measurable,</li>\n<li>batching has limits,</li>\n<li>and post-quantum migration changes everything: signature sizes, verification cost, and message amplification.</li>\n</ul>\n<p>This is not a side note. It changes the effective <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> and the constant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span> in your termination bound.</p>\n<p>Rule of thumb: treat “crypto verification latency p99” as part of your synchrony envelope.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>For liveness, set timeouts against <strong>p99(network + queue + crypto verify)</strong>, not p50 RTT. Then prove that backoff reaches that envelope after GST.</p>\n</div>\n<p>If you plan to swap classical primitives for post-quantum candidates (e.g., Dilithium/Falcon in signatures, Kyber in key exchange), your operational question becomes:</p>\n<blockquote>\n<p>“Do we still terminate under the same fault and delay assumptions once signature verification dominates the critical path?”</p>\n</blockquote>\n<p>The proof can survive if you re-parameterize <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>c</mi></mrow><annotation encoding=\"application/x-tex\">c</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord mathnormal\">c</span></span></span></span></span> — but your SLO might not.</p>\n<h3 id=\"3-memory-pressure-and-bounded-state-liveness-dies-when-you-oom\" style=\"position:relative;\"><a href=\"#3-memory-pressure-and-bounded-state-liveness-dies-when-you-oom\" aria-label=\"3 memory pressure and bounded state liveness dies when you oom permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3) Memory pressure and bounded state: liveness dies when you OOM</h3>\n<p>Formal consensus models rarely encode memory bounds. Real nodes do.</p>\n<p>If an attacker can force you to retain unbounded blocks or QCs, termination becomes irrelevant: the process dies. Your implementation must include:</p>\n<ul>\n<li>bounded block tree (pruning rules),</li>\n<li>bounded message queues,</li>\n<li>and explicit backpressure.</li>\n</ul>\n<p>If you cannot express pruning in the spec, at least express it as an invariant in the code and test it under adversarial schedules.</p>\n<h3 id=\"4-instrumentation-as-proof-preservation\" style=\"position:relative;\"><a href=\"#4-instrumentation-as-proof-preservation\" aria-label=\"4 instrumentation as proof preservation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4) Instrumentation as proof preservation</h3>\n<p>UC proofs provide indistinguishability. Operators need evidence:</p>\n<ul>\n<li>“which lock was used to reject votes?”</li>\n<li>“why did the replica time out?”</li>\n<li>“which QC did we consider highQC?”</li>\n</ul>\n<p>Instrument these as structured logs tied to:</p>\n<ul>\n<li><code class=\"language-text\">(view, leader, highQC.view, lockedQC.view, timeout_ms)</code></li>\n<li>plus cryptographic verification timings.</li>\n</ul>\n<p>In my experience, the systems that survive incidents are the ones where you can reconstruct the protocol trace from partial evidence. That is “high assurance” in the real world.</p>\n<h2 id=\"authority-critique-what-the-paper-proves-and-what-it-doesnt\" style=\"position:relative;\"><a href=\"#authority-critique-what-the-paper-proves-and-what-it-doesnt\" aria-label=\"authority critique what the paper proves and what it doesnt permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Authority critique (what the paper proves, and what it doesn’t)</h2>\n<p>I respect this work. A UC-style termination proof for HotStuff is not easy. But the boundary between “proof” and “system” is where professionals get hurt.</p>\n<p>Limitations that matter if you build fleets:</p>\n<ol>\n<li><strong>UC idealizes resources.</strong> A polynomial-time adversary is not the same as an adversary who saturates your CPU with signature verification and forces queue collapse.</li>\n<li><strong>Partial synchrony is a cliff.</strong> Backoff gives termination after GST, but real networks don’t announce GST. Mis-estimating <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> yields either liveness collapse (too small) or unacceptable latency (too large).</li>\n<li><strong>Implementation complexity is externalized.</strong> The proof doesn’t cover memory bounds, pruning correctness, persistence, replay, upgrade choreography, or operator mistakes — but those are where real outages live.</li>\n<li><strong>The proof target is a model, not your code.</strong> Without a disciplined refinement mapping and implementation invariants, you can “prove HotStuff terminates” and still ship a non-terminating Rust node.</li>\n<li><strong>Industrial heterogeneity breaks constants.</strong> IIoT and edge deployments are not homogeneous servers. If half your fleet is slower, leader success probability changes and effective <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> changes.</li>\n</ol>\n<p>The lesson isn’t “ignore proofs”. The lesson is: <strong>treat proofs as specs for engineering guardrails</strong>, not as certificates of deployed behavior.</p>\n<h2 id=\"the-future-of-high-assurance-engineering\" style=\"position:relative;\"><a href=\"#the-future-of-high-assurance-engineering\" aria-label=\"the future of high assurance engineering permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Future of High-Assurance Engineering</h2>\n<p>High-assurance engineering is converging on a sober reality:</p>\n<ul>\n<li>Safety proofs are necessary.</li>\n<li>Termination proofs are the part that saves you at 03:17.</li>\n<li>And neither matters if you cannot carry the invariants through the implementation boundary.</li>\n</ul>\n<p>The next generation of systems that “cannot fail” will not be built by adding more diagrams. They’ll be built by:</p>\n<ol>\n<li>writing specs that include time, compute, and adversaries as first-class inputs,</li>\n<li>enforcing invariants in code (types + single-owner state machines + explicit scheduling),</li>\n<li>treating cryptographic parameters as part of liveness, not just security,</li>\n<li>and operationalizing the proof (monitoring + rollback + evidence).</li>\n</ol>\n<p>If you’re building in Rust, the path is clear: make the protocol state explicit, make invalid states unrepresentable, and then prove a refinement mapping — even if it starts as a disciplined argument before it becomes a mechanized proof.</p>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li>The termination claim and backoff framing come from the HotStuff UC termination paper (IACR ePrint 2025/1560): <a href=\"https://eprint.iacr.org/2025/1560\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">eprint.iacr.org/2025/1560</a>. <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--10\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></li>\n<li>HotStuff’s pipelined structure and safety intuition are grounded in the original HotStuff paper: <a href=\"https://arxiv.org/abs/1803.05069\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">arxiv.org/abs/1803.05069</a>. <span class=\"citation\" id=\"citation--yin2019hotstuff--11\">(<a href=\"#bib-yin2019hotstuff\">2</a>)</span></li>\n<li>The partial synchrony model that makes termination provable (after GST) traces back to classic results: <a href=\"https://groups.csail.mit.edu/tds/papers/Lynch/jacm88.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">groups.csail.mit.edu/.../jacm88.pdf</a>. <span class=\"citation\" id=\"citation--dls1988partialsynchrony--12\">(<a href=\"#bib-dls1988partialsynchrony\">3</a>)</span></li>\n<li>UC’s “real vs ideal” paradigm: <a href=\"https://eprint.iacr.org/2000/067.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">eprint.iacr.org/2000/067.pdf</a>. <span class=\"citation\" id=\"citation--canetti2001uc--13\">(<a href=\"#bib-canetti2001uc\">4</a>)</span></li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul>\n<li>Document GST/partial synchrony assumptions and define what <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">Δ</mi></mrow><annotation encoding=\"application/x-tex\">\\Delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\">Δ</span></span></span></span></span> includes (network + queues + crypto + scheduling).</li>\n<li>Encode lock/highQC invariants explicitly; add assertions and telemetry for state transitions.</li>\n<li>Implement exponential backoff as a protocol mechanism with config hashing and rollout gates.</li>\n<li>Bound memory (block tree pruning, queue limits) and prove pruning doesn’t violate safety invariants.</li>\n<li>Add monitors for view-change rate, leader success probability, QC propagation lag, and timeout divergence.</li>\n<li>Make rollback safe (epoch boundaries, feature flags, deterministic config snapshots).</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li>Zeng et al., “On the Termination of the HotStuff Protocol Within the Universally Composable Framework” (IACR ePrint 2025/1560): <a href=\"https://eprint.iacr.org/2025/1560\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">eprint.iacr.org/2025/1560</a>. <span class=\"citation\" id=\"citation--zeng2025hotstuffuc--14\">(<a href=\"#bib-zeng2025hotstuffuc\">1</a>)</span></li>\n<li>Yin et al., “HotStuff: BFT Consensus with Linearity and Responsiveness” (PODC 2019 / arXiv): <a href=\"https://arxiv.org/abs/1803.05069\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">arxiv.org/abs/1803.05069</a>. <span class=\"citation\" id=\"citation--yin2019hotstuff--15\">(<a href=\"#bib-yin2019hotstuff\">2</a>)</span></li>\n<li>Canetti, “Universally Composable Security: A New Paradigm for Cryptographic Protocols” (FOCS 2001; ePrint): <a href=\"https://eprint.iacr.org/2000/067.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">eprint.iacr.org/2000/067.pdf</a>. <span class=\"citation\" id=\"citation--canetti2001uc--16\">(<a href=\"#bib-canetti2001uc\">4</a>)</span></li>\n<li>Dwork, Lynch, Stockmeyer, “Consensus in the Presence of Partial Synchrony” (JACM 1988): <a href=\"https://groups.csail.mit.edu/tds/papers/Lynch/jacm88.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">groups.csail.mit.edu/.../jacm88.pdf</a>. <span class=\"citation\" id=\"citation--dls1988partialsynchrony--17\">(<a href=\"#bib-dls1988partialsynchrony\">3</a>)</span></li>\n<li>Learn TLA+ (practical workflow): <a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">learntla.com</a>. <span class=\"citation\" id=\"citation--learntla--18\">(<a href=\"#bib-learntla\">5</a>)</span></li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-zeng2025hotstuffuc\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Zeng Y, Dong Z, Xu X. On the Termination of the HotStuff Protocol Within the Universally Composable Framework [Internet]. IACR Cryptology ePrint Archive, Report 2025/1560; 2025. Available from: https://eprint.iacr.org/2025/1560</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-yin2019hotstuff\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Yin M, Malkhi D, Reiter MK, Gueta GG, Abraham I. HotStuff: BFT Consensus with Linearity and Responsiveness. In: Proceedings of the 2019 ACM Symposium on Principles of Distributed Computing (PODC ’19) [Internet]. 2019. Available from: https://arxiv.org/abs/1803.05069</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-dls1988partialsynchrony\">\n    <div class=\"csl-left-margin\">3. </div><div class=\"csl-right-inline\">Dwork C, Lynch N, Stockmeyer L. Consensus in the Presence of Partial Synchrony. In: Journal of the ACM [Internet]. 1988. p. 288–323. Available from: https://groups.csail.mit.edu/tds/papers/Lynch/jacm88.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-canetti2001uc\">\n    <div class=\"csl-left-margin\">4. </div><div class=\"csl-right-inline\">Canetti R. Universally Composable Security: A New Paradigm for Cryptographic Protocols. In: 42nd IEEE Symposium on Foundations of Computer Science (FOCS 2001) [Internet]. 2001. Available from: https://eprint.iacr.org/2000/067.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">5. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2026-03-hotstuff-termination-uc-delay-attacks",
            "title": "Termination Is a Security Boundary: HotStuff Under UC, Delay Attacks, and the Uncomfortable Gap to Rust",
            "summary": "Paper note (March 2026): a UC-style termination proof for HotStuff, the real invariant it relies on, and what changes when you ship it as a low-level Rust system under adversarial latency.",
            "date_modified": "2026-03-28T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "consensus",
                "BFT",
                "formal-methods",
                "cryptography",
                "Rust",
                "security"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2026-03-secure-distributed-storage-erasure-coding-under-adversaries",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Deep Systems Notes</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secure Distributed Storage: Erasure Coding Under Adversaries</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Operational behavior is part of correctness: rollout, rollback, and evidence.</li>\n<li>Interfaces must carry assumptions: time, randomness, identity, and ordering.</li>\n<li>Contracts need enforcement: tests, assertions, and monitoring—not documentation.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational behavior is part of correctness (rollouts, rollbacks, drift).</li>\n<li>Resilience requires making failure modes explicit and bounded.</li>\n<li>Mixed-version operation creates states you didn’t model.</li>\n<li>Security becomes optional through configuration drift unless enforced.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What are your compositional failure modes (partial deploys, mixed versions)?</li>\n<li>How do you prevent 'optional security' from appearing via config drift?</li>\n<li>Which proofs are worth maintaining vs replacing with tests and monitoring?</li>\n<li>What is the smallest integration test that can falsify your assumptions?</li>\n<li>Which assumptions leak across boundaries (time, randomness, identity, ordering)?</li>\n<li>Where does 'correctness' become an operational contract (SLOs, budgets, policy)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Observability is imperfect; you debug from partial evidence.</li>\n<li>Upgrades are incremental; compatibility is a security boundary.</li>\n<li>Integration happens under time pressure; defaults become de facto policy.</li>\n<li>Components are built by different teams with different threat models.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “tribal knowledge” to connect assumptions across layers.</li>\n<li>Assuming proofs automatically survive composition.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Interface contracts are predicates:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>caller obeys </mtext><mi>P</mi><mo>⇒</mo><mtext>callee guarantees </mtext><mi>Q</mi><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{caller obeys } P \\Rightarrow \\text{callee guarantees } Q.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">caller obeys </span></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">callee guarantees </span></span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat config as code: version it, review it, and monitor drift.</p>\n<p>Make assumptions executable: encode them as assertions, tests, and run-time checks.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  spec<span class=\"token text string\">[\"Spec\"]</span> <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Impl\"]</span>\n  impl <span class=\"token arrow operator\">--></span> proofs<span class=\"token text string\">[\"Proofs / Tests\"]</span>\n  proofs <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Ops\"]</span>\n  ops <span class=\"token arrow operator\">--></span> incidents<span class=\"token text string\">[\"Incidents\"]</span>\n  incidents <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat integration boundaries (FFI, services, queues) as formal interfaces.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Integration note: treat FFI/service boundaries as an API with invariants.</span>\n<span class=\"token comment\">// Encode invariants as types where possible, assertions otherwise.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>End-to-end property tests</strong> for the smallest meaningful workflow.</li>\n<li><strong>Upgrade tests</strong> for mixed-version and rollback scenarios.</li>\n<li><strong>Contract tests</strong> at boundaries with adversarial inputs and skew.</li>\n<li><strong>Fault injection</strong> at seams (queues, caches, RPC) not only components.</li>\n<li><strong>Invariant monitoring</strong> tied to incident response playbooks.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Use canaries for protocol and crypto changes; define rollback triggers.</li>\n<li>Treat config drift as an incident: detect, alert, and remediate.</li>\n<li>Maintain runbooks that reference invariants, not just symptoms.</li>\n<li>Make security and correctness properties observable (metrics + alerts).</li>\n<li>Store evidence: audit logs, config diffs, and deployment metadata.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which assumptions do you currently enforce only through convention?</li>\n<li>Where can config silently weaken security properties today?</li>\n<li>Which properties can be proven locally vs only tested end-to-end?</li>\n<li>What boundary is most likely to be bypassed under incident pressure?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://web.mit.edu/Saltzer/www/publications/endtoend/endtoend.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">End-to-End Arguments in System Design</a> — A foundational argument about where to enforce correctness properties.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc1122\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 1122: Requirements for Internet Hosts</a> — A classic example of operational constraints becoming protocol reality.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Integration-focused fault testing and correctness thinking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2026-03-secure-distributed-storage-erasure-coding-under-adversaries",
            "title": "Secure Distributed Storage: Erasure Coding Under Adversaries",
            "summary": "Spec-driven research note (March 2026): Secure Distributed Storage: Erasure Coding Under Adversaries.",
            "date_modified": "2026-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "cryptography",
                "formal-methods",
                "security"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2026-02-verifiable-computation-as-infrastructure-proof-systems-at-sc",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Deep Systems Notes</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Verifiable Computation as Infrastructure: Proof Systems at Scale</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Interfaces must carry assumptions: time, randomness, identity, and ordering.</li>\n<li>Operational behavior is part of correctness: rollout, rollback, and evidence.</li>\n<li>Integration boundaries are where proofs evaporate; treat them as first-class.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most real failures happen at integration boundaries, not inside components.</li>\n<li>Operational behavior is part of correctness (rollouts, rollbacks, drift).</li>\n<li>Mixed-version operation creates states you didn’t model.</li>\n<li>Resilience requires making failure modes explicit and bounded.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you keep ‘security properties’ visible to operators and SREs?</li>\n<li>Where does 'correctness' become an operational contract (SLOs, budgets, policy)?</li>\n<li>What are your compositional failure modes (partial deploys, mixed versions)?</li>\n<li>What is the smallest integration test that can falsify your assumptions?</li>\n<li>Which proofs are worth maintaining vs replacing with tests and monitoring?</li>\n<li>How do you prevent 'optional security' from appearing via config drift?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Components are built by different teams with different threat models.</li>\n<li>Upgrades are incremental; compatibility is a security boundary.</li>\n<li>Integration happens under time pressure; defaults become de facto policy.</li>\n<li>Observability is imperfect; you debug from partial evidence.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Allowing config to silently weaken security properties.</li>\n<li>Relying on “tribal knowledge” to connect assumptions across layers.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Composability is the promise that proofs survive integration:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">A</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi></mrow><mrow><msub><mi mathvariant=\"normal\">Π</mi><mn>1</mn></msub><mo>∘</mo><msub><mi mathvariant=\"normal\">Π</mi><mn>2</mn></msub></mrow></msub><mo>≤</mo><msub><mrow><mi mathvariant=\"normal\">A</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi></mrow><msub><mi mathvariant=\"normal\">Π</mi><mn>1</mn></msub></msub><mo>+</mo><msub><mrow><mi mathvariant=\"normal\">A</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi></mrow><msub><mi mathvariant=\"normal\">Π</mi><mn>2</mn></msub></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Adv}_{\\Pi_1\\circ \\Pi_2} \\le \\mathrm{Adv}_{\\Pi_1} + \\mathrm{Adv}_{\\Pi_2}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.9445em;vertical-align:-0.2501em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Adv</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">Π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span><span class=\"mbin mtight\">∘</span><span class=\"mord mtight\"><span class=\"mord mtight\">Π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2501em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.9445em;vertical-align:-0.2501em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Adv</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">Π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2501em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.9445em;vertical-align:-0.2501em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Adv</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3283em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\">Π</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3173em;\"><span style=\"top:-2.357em;margin-left:0em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.143em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2501em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make assumptions executable: encode them as assertions, tests, and run-time checks.</p>\n<p>Choose what to prove and what to monitor. Both are necessary in practice.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  boundary<span class=\"token text string\">[\"Boundary\"]</span> <span class=\"token arrow operator\">--></span> contract[<span class=\"token string\">\"Contract (P -> Q)\"</span>]\n  contract <span class=\"token arrow operator\">--></span> test<span class=\"token text string\">[\"Tests\"]</span>\n  test <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitoring\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> incident<span class=\"token text string\">[\"Incident\"]</span>\n  incident <span class=\"token arrow operator\">--></span> contract</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>If it’s not enforced, it’s not a contract.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Boundary contract template:\nPreconditions (P):\n- input validation, size limits, auth context\n- monotonic versions / idempotency keys\nPostconditions (Q):\n- durable state transitions\n- evidence emitted (audit/metrics)\nFailure modes:\n- explicit, typed, and observable</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>End-to-end property tests</strong> for the smallest meaningful workflow.</li>\n<li><strong>Upgrade tests</strong> for mixed-version and rollback scenarios.</li>\n<li><strong>Fault injection</strong> at seams (queues, caches, RPC) not only components.</li>\n<li><strong>Invariant monitoring</strong> tied to incident response playbooks.</li>\n<li><strong>Contract tests</strong> at boundaries with adversarial inputs and skew.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat config drift as an incident: detect, alert, and remediate.</li>\n<li>Maintain runbooks that reference invariants, not just symptoms.</li>\n<li>Store evidence: audit logs, config diffs, and deployment metadata.</li>\n<li>Make security and correctness properties observable (metrics + alerts).</li>\n<li>Use canaries for protocol and crypto changes; define rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What boundary is most likely to be bypassed under incident pressure?</li>\n<li>Which assumptions do you currently enforce only through convention?</li>\n<li>Which properties can be proven locally vs only tested end-to-end?</li>\n<li>Where can config silently weaken security properties today?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://web.mit.edu/Saltzer/www/publications/endtoend/endtoend.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">End-to-End Arguments in System Design</a> — A foundational argument about where to enforce correctness properties.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Integration-focused fault testing and correctness thinking.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc1122\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 1122: Requirements for Internet Hosts</a> — A classic example of operational constraints becoming protocol reality.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2026-02-verifiable-computation-as-infrastructure-proof-systems-at-sc",
            "title": "Verifiable Computation as Infrastructure: Proof Systems at Scale",
            "summary": "Engineering notebook entry (February 2026): Verifiable Computation as Infrastructure: Proof Systems at Scale.",
            "date_modified": "2026-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "cryptography",
                "formal-methods",
                "security"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2026-01-composable-security-where-proofs-break-in-real-systems",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Deep Systems Notes</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Composable Security: Where Proofs Break in Real Systems</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Operational behavior is part of correctness: rollout, rollback, and evidence.</li>\n<li>Contracts need enforcement: tests, assertions, and monitoring—not documentation.</li>\n<li>Integration boundaries are where proofs evaporate; treat them as first-class.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Security becomes optional through configuration drift unless enforced.</li>\n<li>Most real failures happen at integration boundaries, not inside components.</li>\n<li>Resilience requires making failure modes explicit and bounded.</li>\n<li>Operational behavior is part of correctness (rollouts, rollbacks, drift).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which assumptions leak across boundaries (time, randomness, identity, ordering)?</li>\n<li>Which proofs are worth maintaining vs replacing with tests and monitoring?</li>\n<li>What are your compositional failure modes (partial deploys, mixed versions)?</li>\n<li>How do you keep ‘security properties’ visible to operators and SREs?</li>\n<li>How do you prevent 'optional security' from appearing via config drift?</li>\n<li>Where does 'correctness' become an operational contract (SLOs, budgets, policy)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Components are built by different teams with different threat models.</li>\n<li>Integration happens under time pressure; defaults become de facto policy.</li>\n<li>Adversaries exploit ambiguity between systems, not within them.</li>\n<li>Observability is imperfect; you debug from partial evidence.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “tribal knowledge” to connect assumptions across layers.</li>\n<li>Allowing config to silently weaken security properties.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Interface contracts are predicates:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>caller obeys </mtext><mi>P</mi><mo>⇒</mo><mtext>callee guarantees </mtext><mi>Q</mi><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{caller obeys } P \\Rightarrow \\text{callee guarantees } Q.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">caller obeys </span></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">callee guarantees </span></span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make assumptions executable: encode them as assertions, tests, and run-time checks.</p>\n<p>Treat config as code: version it, review it, and monitor drift.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  boundary<span class=\"token text string\">[\"Boundary\"]</span> <span class=\"token arrow operator\">--></span> contract[<span class=\"token string\">\"Contract (P -> Q)\"</span>]\n  contract <span class=\"token arrow operator\">--></span> test<span class=\"token text string\">[\"Tests\"]</span>\n  test <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitoring\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> incident<span class=\"token text string\">[\"Incident\"]</span>\n  incident <span class=\"token arrow operator\">--></span> contract</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Operational constraints are part of the design: deploy, rollback, and drift.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Integration note: treat FFI/service boundaries as an API with invariants.</span>\n<span class=\"token comment\">// Encode invariants as types where possible, assertions otherwise.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>End-to-end property tests</strong> for the smallest meaningful workflow.</li>\n<li><strong>Invariant monitoring</strong> tied to incident response playbooks.</li>\n<li><strong>Upgrade tests</strong> for mixed-version and rollback scenarios.</li>\n<li><strong>Contract tests</strong> at boundaries with adversarial inputs and skew.</li>\n<li><strong>Fault injection</strong> at seams (queues, caches, RPC) not only components.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Use canaries for protocol and crypto changes; define rollback triggers.</li>\n<li>Maintain runbooks that reference invariants, not just symptoms.</li>\n<li>Store evidence: audit logs, config diffs, and deployment metadata.</li>\n<li>Treat config drift as an incident: detect, alert, and remediate.</li>\n<li>Make security and correctness properties observable (metrics + alerts).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Integration-focused fault testing and correctness thinking.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where can config silently weaken security properties today?</li>\n<li>Which assumptions do you currently enforce only through convention?</li>\n<li>What boundary is most likely to be bypassed under incident pressure?</li>\n<li>Which properties can be proven locally vs only tested end-to-end?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc1122\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 1122: Requirements for Internet Hosts</a> — A classic example of operational constraints becoming protocol reality.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Integration-focused fault testing and correctness thinking.</li>\n<li><a href=\"https://web.mit.edu/Saltzer/www/publications/endtoend/endtoend.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">End-to-End Arguments in System Design</a> — A foundational argument about where to enforce correctness properties.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2026-01-composable-security-where-proofs-break-in-real-systems",
            "title": "Composable Security: Where Proofs Break in Real Systems",
            "summary": "Threat-model-first analysis (January 2026): Composable Security: Where Proofs Break in Real Systems.",
            "date_modified": "2026-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "cryptography",
                "formal-methods",
                "security"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-12-research-frontiers-composability-proofs-and-future-primitive",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Research Frontiers: Composability, Proofs, and Future Primitives</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming performance impacts will be negligible.</li>\n<li>Treating PQ migration as a single deployment event.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  threat<span class=\"token text string\">[\"Threat Model (quantum + classical)\"]</span> <span class=\"token arrow operator\">--></span> design<span class=\"token text string\">[\"Protocol Design\"]</span>\n  design <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (no_std where needed)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> verify<span class=\"token text string\">[\"Verification (tests + formal)\"]</span>\n  verify <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Operationalization (rotation + monitoring)\"]</span>\n  ops <span class=\"token arrow operator\">--></span> threat</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>PQ readiness is a systems program: crypto, networking, ops, and UX must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-12-research-frontiers-composability-proofs-and-future-primitive",
            "title": "Research Frontiers: Composability, Proofs, and Future Primitives",
            "summary": "Threat-model-first analysis (December 2025): Research Frontiers: Composability, Proofs, and Future Primitives.",
            "date_modified": "2025-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-11-long-lived-secrets-forward-secrecy-kems-and-key-erasure",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Long-Lived Secrets: Forward Secrecy, KEMs, and Key Erasure</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n<li>Treating PQ migration as a single deployment event.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Risk is a function of exposure and lifetime:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo>≈</mo><mrow><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{risk} \\approx \\mathrm{exposure} \\times \\mathrm{lifetime} \\times \\mathrm{adversary\\_capability}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">risk</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">exposure</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.0833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">lifetime</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">adversary_capability</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Operationalize early: rollback and monitoring are part of the design.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--1\">(<a href=\"#bib-rfc8446\">1</a>)</span> — A useful reference for handshake structure and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-11-long-lived-secrets-forward-secrecy-kems-and-key-erasure",
            "title": "Long-Lived Secrets: Forward Secrecy, KEMs, and Key Erasure",
            "summary": "Design memo (November 2025): Long-Lived Secrets: Forward Secrecy, KEMs, and Key Erasure.",
            "date_modified": "2025-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-10-post-quantum-dos-surfaces-handshakes-amplification-and-mitig",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Post-Quantum DoS Surfaces: Handshakes, Amplification, and Mitigations</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming performance impacts will be negligible.</li>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Risk is a function of exposure and lifetime:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo>≈</mo><mrow><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{risk} \\approx \\mathrm{exposure} \\times \\mathrm{lifetime} \\times \\mathrm{adversary\\_capability}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">risk</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">exposure</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.0833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">lifetime</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">adversary_capability</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Design hybrid modes with explicit binding and observable outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-10-post-quantum-dos-surfaces-handshakes-amplification-and-mitig",
            "title": "Post-Quantum DoS Surfaces: Handshakes, Amplification, and Mitigations",
            "summary": "Adversarial-first deep dive (October 2025): Post-Quantum DoS Surfaces: Handshakes, Amplification, and Mitigations.",
            "date_modified": "2025-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-09-operationalizing-pqc-monitoring-rollback-and-incident-respon",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Operationalizing PQC: Monitoring, Rollback, and Incident Response</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming performance impacts will be negligible.</li>\n<li>Treating PQ migration as a single deployment event.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  threat<span class=\"token text string\">[\"Threat Model (quantum + classical)\"]</span> <span class=\"token arrow operator\">--></span> design<span class=\"token text string\">[\"Protocol Design\"]</span>\n  design <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (no_std where needed)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> verify<span class=\"token text string\">[\"Verification (tests + formal)\"]</span>\n  verify <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Operationalization (rotation + monitoring)\"]</span>\n  ops <span class=\"token arrow operator\">--></span> threat</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>PQ readiness is a systems program: crypto, networking, ops, and UX must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Migration scoreboard:\n- Inventory coverage (% of services/devices)\n- Hybrid enabled (% of traffic)\n- Negotiation failures (by client cohort)\n- Handshake cost (CPU/bandwidth p95/p99)\n- Downgrade attempts detected</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — The standardization baseline for PQC readiness programs.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-09-operationalizing-pqc-monitoring-rollback-and-incident-respon",
            "title": "Operationalizing PQC: Monitoring, Rollback, and Incident Response",
            "summary": "Spec-driven research note (September 2025): Operationalizing PQC: Monitoring, Rollback, and Incident Response.",
            "date_modified": "2025-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/blog/quantum-tunneler",
            "content_html": "<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction</h2>\n<p>As quantum computing capabilities advance, classical public-key schemes such as RSA and ECC face existential threats. <strong>Quantum Tunneler</strong> is a ground-up Rust implementation of a fully <strong>quantum-safe IPSec stack</strong>, demonstrating how to build secure network tunnels that resist adversaries equipped with quantum hardware. This article walks through the motivations, the core architecture, and the deep technical details that make Quantum Tunneler both performant and future-proof.</p>\n<h2 id=\"the-quantum-threat--motivation\" style=\"position:relative;\"><a href=\"#the-quantum-threat--motivation\" aria-label=\"the quantum threat  motivation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Quantum Threat &#x26; Motivation</h2>\n<ol>\n<li><strong>Shor’s Algorithm</strong> breaks RSA/ECDSA/ECDH in polynomial time.</li>\n<li><strong>Harvest-now, decrypt-later</strong> attacks put any recorded IPSec sessions at risk.</li>\n<li><strong>Regulatory &#x26; compliance</strong> demands are shifting toward post-quantum readiness.</li>\n</ol>\n<p>Quantum Tunneler addresses these challenges by replacing the classical Diffie-Hellman and signature primitives at every layer of the IPSec stack with <strong>NIST-recommended post-quantum algorithms</strong>:</p>\n<ul>\n<li><strong>CRYSTALS-Kyber</strong> for Key Encapsulation Mechanism (KEM)</li>\n<li><strong>Falcon</strong> for digital signatures</li>\n</ul>\n<h2 id=\"post-quantum-cryptography-primer\" style=\"position:relative;\"><a href=\"#post-quantum-cryptography-primer\" aria-label=\"post quantum cryptography primer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Post-Quantum Cryptography Primer</h2>\n<p>Before diving into the implementation, a quick recap of the two core algorithms:</p>\n<ul>\n<li><strong>Kyber (KEM)</strong>\n<ul>\n<li><strong>KeyGen</strong>: outputs <code class=\"language-text\">(pk, sk)</code></li>\n<li><strong>Encapsulate</strong>: using <code class=\"language-text\">pk</code> produces <code class=\"language-text\">(ct, ss)</code></li>\n<li><strong>Decapsulate</strong>: using <code class=\"language-text\">sk</code> and <code class=\"language-text\">ct</code> recovers the same <code class=\"language-text\">ss</code></li>\n</ul>\n</li>\n<li><strong>Falcon (Signature)</strong>\n<ul>\n<li><strong>KeyGen</strong>: outputs <code class=\"language-text\">(pk, sk)</code></li>\n<li><strong>Sign</strong>: using <code class=\"language-text\">sk</code> signs arbitrary message bytes → <code class=\"language-text\">sig</code></li>\n<li><strong>Verify</strong>: using <code class=\"language-text\">pk</code>, <code class=\"language-text\">msg</code>, <code class=\"language-text\">sig</code> → boolean</li>\n</ul>\n</li>\n</ul>\n<p>Both are implemented in pure Rust (with optional <code class=\"language-text\">no_std</code>) and integrated via generic traits:</p>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">KeyEncapsulation</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">PublicKey</span><span class=\"token punctuation\">;</span> <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">SecretKey</span><span class=\"token punctuation\">;</span> <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Ciphertext</span><span class=\"token punctuation\">;</span> <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">SharedSecret</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">keygen</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">(</span><span class=\"token class-name\">PublicKey</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">SecretKey</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">encapsulate</span><span class=\"token punctuation\">(</span>pk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">PublicKey</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">(</span><span class=\"token class-name\">Ciphertext</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">SharedSecret</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">decapsulate</span><span class=\"token punctuation\">(</span>sk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">SecretKey</span><span class=\"token punctuation\">,</span> ct<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">Ciphertext</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">SharedSecret</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">DigitalSignature</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">PublicKey</span><span class=\"token punctuation\">;</span> <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">SecretKey</span><span class=\"token punctuation\">;</span> <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Signature</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">keygen</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">(</span><span class=\"token class-name\">PublicKey</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">SecretKey</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">sign</span><span class=\"token punctuation\">(</span>sk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">SecretKey</span><span class=\"token punctuation\">,</span> message<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Signature</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">verify</span><span class=\"token punctuation\">(</span>pk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">PublicKey</span><span class=\"token punctuation\">,</span> message<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span> sig<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">Signature</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"ipsec--ikev2-overview\" style=\"position:relative;\"><a href=\"#ipsec--ikev2-overview\" aria-label=\"ipsec  ikev2 overview permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>IPSec &#x26; IKEv2 Overview</h2>\n<p>IPSec provides <strong>confidentiality</strong>, <strong>integrity</strong>, and <strong>anti-replay</strong> for IP packets via two main components:</p>\n<ul>\n<li><strong>IKEv2</strong>: mutual authentication &#x26; key exchange</li>\n<li><strong>ESP/AH</strong>: packet encapsulation &#x26; integrity tags</li>\n</ul>\n<p>Quantum Tunneler replaces:</p>\n<ul>\n<li>The classical Diffie-Hellman in <strong>IKE_SA_INIT</strong> with a Kyber KEM exchange.</li>\n<li>The RSA/ECDSA signature in <strong>IKE_AUTH</strong> with Falcon.</li>\n<li>The symmetric ciphers / MACs in ESP/AH with hybrid or pure-PQC constructs derived from shared secrets.</li>\n</ul>\n<h2 id=\"architecture--workspace-layout\" style=\"position:relative;\"><a href=\"#architecture--workspace-layout\" aria-label=\"architecture  workspace layout permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Architecture &#x26; Workspace Layout</h2>\n<p>Quantum Tunneler is organized as a Rust <em>workspace</em>:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">quantum-tunneler/\n├── Cargo.toml            # workspace\n├── quantum_ipsec/        # core library\n│   ├── Cargo.toml\n│   └── src/\n│       ├── crypto/       # kyber.rs, falcon.rs, traits.rs\n│       ├── ikev2/        # initiator.rs, responder.rs, parser.rs\n│       ├── ipsec/        # esp.rs, ah.rs, sa.rs, policy.rs\n│       └── utils.rs      # common types &amp; helpers\n└── cli/                  # command-line interface\n    ├── Cargo.toml\n    └── src/\n        ├── main.rs\n        └── commands/     # init.rs, connect.rs, status.rs, benchmark.rs</code></pre></div>\n<h3 id=\"core-crate-quantum_ipsec\" style=\"position:relative;\"><a href=\"#core-crate-quantum_ipsec\" aria-label=\"core crate quantum_ipsec permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Core Crate (<code class=\"language-text\">quantum_ipsec</code>)</h3>\n<ul>\n<li>\n<p><strong><code class=\"language-text\">crypto/</code></strong></p>\n<ul>\n<li><code class=\"language-text\">kyber.rs</code>: native Rust KEM implementation, optional use of <a href=\"https://docs.rs/pqcrypto\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">pqcrypto</code></a>.</li>\n<li><code class=\"language-text\">falcon.rs</code>: signature scheme, vendored C bindings via <code class=\"language-text\">unsafe</code> FFI or pure-Rust port.</li>\n<li><code class=\"language-text\">traits.rs</code>: defines <code class=\"language-text\">KeyEncapsulation</code> &#x26; <code class=\"language-text\">DigitalSignature</code>.</li>\n</ul>\n</li>\n<li>\n<p><strong><code class=\"language-text\">ikev2/</code></strong></p>\n<ul>\n<li><code class=\"language-text\">parser.rs</code>: BER-style message parsing / serialization per RFC 7296.</li>\n<li><code class=\"language-text\">initiator.rs</code> / <code class=\"language-text\">responder.rs</code>: orchestrate IKE_SA_INIT and IKE_AUTH flows.</li>\n<li><code class=\"language-text\">crypto_adapter.rs</code>: bridges IKE messages to <code class=\"language-text\">crypto</code> module.</li>\n</ul>\n</li>\n<li>\n<p><strong><code class=\"language-text\">ipsec/</code></strong></p>\n<ul>\n<li><code class=\"language-text\">esp.rs</code>: encapsulates and decapsulates IP packets using shared secrets.</li>\n<li><code class=\"language-text\">ah.rs</code>: computes/validates Falcon-based authentication tags.</li>\n<li><code class=\"language-text\">sa.rs</code>: in-memory store of SPIs, nonces, sequence counters.</li>\n<li><code class=\"language-text\">policy.rs</code>: Security Policy Database (SPD) and SAD management.</li>\n</ul>\n</li>\n</ul>\n<h3 id=\"cli-quantum-ipsec\" style=\"position:relative;\"><a href=\"#cli-quantum-ipsec\" aria-label=\"cli quantum ipsec permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>CLI (<code class=\"language-text\">quantum-ipsec</code>)</h3>\n<p>All commands are thin wrappers around core APIs via <a href=\"https://docs.rs/clap\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">clap</code></a>. Sample usage:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token comment\"># Initialize local peer, generate PQC keypairs</span>\nquantum-ipsec init <span class=\"token parameter variable\">--config</span> default.toml\n\n<span class=\"token comment\"># Negotiate IKEv2 with remote peer</span>\nquantum-ipsec connect <span class=\"token parameter variable\">--peer</span> <span class=\"token number\">10.0</span>.0.2 <span class=\"token parameter variable\">--mode</span> tunnel\n\n<span class=\"token comment\"># Inspect active SAs</span>\nquantum-ipsec status <span class=\"token parameter variable\">--json</span>\n\n<span class=\"token comment\"># Benchmark handshake &amp; packet throughput</span>\nquantum-ipsec benchmark <span class=\"token parameter variable\">--duration</span> 30s --payload-size <span class=\"token number\">512</span></code></pre></div>\n<h2 id=\"deep-dive-esp-packet-flow\" style=\"position:relative;\"><a href=\"#deep-dive-esp-packet-flow\" aria-label=\"deep dive esp packet flow permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deep Dive: ESP Packet Flow</h2>\n<ol>\n<li><strong>SA Lookup</strong>: find SA by SPI</li>\n<li><strong>Key Derivation</strong>: derive symmetric key via HKDF from Kyber <code class=\"language-text\">SharedSecret</code></li>\n<li><strong>Encryption</strong>: encrypt payload with XChaCha20-Poly1305 (or pure-PQC hybrid)</li>\n<li><strong>MAC</strong>: compute Falcon signature over header + ciphertext</li>\n<li><strong>Output</strong>: <code class=\"language-text\">[ SPI | Sequence Number | Ciphertext | Signature ]</code></li>\n</ol>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">pub</span> <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">encrypt_packet</span><span class=\"token punctuation\">(</span>sa<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token class-name\">SecurityAssociation</span><span class=\"token punctuation\">,</span> plaintext<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">IpPacket</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">let</span> sym_key <span class=\"token operator\">=</span> <span class=\"token function\">hkdf_expand</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>sa<span class=\"token punctuation\">.</span>shared_secret<span class=\"token punctuation\">,</span> <span class=\"token string\">b\"esp-key\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">let</span> ciphertext <span class=\"token operator\">=</span> <span class=\"token class-name\">XChaCha20Poly1305</span><span class=\"token punctuation\">::</span><span class=\"token function\">new</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>sym_key<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">encrypt</span><span class=\"token punctuation\">(</span>nonce<span class=\"token punctuation\">,</span> plaintext<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">let</span> signature <span class=\"token operator\">=</span> <span class=\"token class-name\">Falcon</span><span class=\"token punctuation\">::</span><span class=\"token function\">sign</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>sa<span class=\"token punctuation\">.</span>sk_sig<span class=\"token punctuation\">,</span> <span class=\"token operator\">&amp;</span>ciphertext<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token class-name\">IpPacket</span> <span class=\"token punctuation\">{</span> spi<span class=\"token punctuation\">:</span> sa<span class=\"token punctuation\">.</span>spi<span class=\"token punctuation\">,</span> seq<span class=\"token punctuation\">:</span> sa<span class=\"token punctuation\">.</span><span class=\"token function\">seq_next</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> data<span class=\"token punctuation\">:</span> ciphertext<span class=\"token punctuation\">,</span> auth<span class=\"token punctuation\">:</span> signature <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"performance-considerations--benchmarking\" style=\"position:relative;\"><a href=\"#performance-considerations--benchmarking\" aria-label=\"performance considerations  benchmarking permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Performance Considerations &#x26; Benchmarking</h2>\n<ul>\n<li><strong>Handshake Latency</strong>: measured via <code class=\"language-text\">criterion</code> for 1 000 Kyber encapsulations + Falcon signatures.</li>\n<li><strong>Throughput</strong>: payload encryption/decryption at various sizes (64 B–1500 B).</li>\n<li><strong>Memory Footprint</strong>: <code class=\"language-text\">no_std</code> build size (~80 KB on Cortex-M4).</li>\n<li><strong>Concurrency</strong>: multi-peer stress tests using asynchronous Tokio drivers.</li>\n</ul>\n<h2 id=\"testing--validation\" style=\"position:relative;\"><a href=\"#testing--validation\" aria-label=\"testing  validation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Testing &#x26; Validation</h2>\n<ul>\n<li><strong>Official Test Vectors</strong> from NIST for Kyber and Falcon.</li>\n<li><strong>Fuzzing</strong> with <code class=\"language-text\">proptest</code> on parsers (<code class=\"language-text\">parser.rs</code>).</li>\n<li><strong>Integration</strong>: two-node TUN/TAP simulation, packet dumps inspected in Wireshark.</li>\n<li><strong>Fault Injection</strong>: truncated messages, invalid SPIs, replayed packets.</li>\n</ul>\n<h2 id=\"future-extensions\" style=\"position:relative;\"><a href=\"#future-extensions\" aria-label=\"future extensions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Future Extensions</h2>\n<ul>\n<li><strong>Hybrid Mode</strong>: combine AES-GCM with Kyber fallback for incremental migration.</li>\n<li><strong>WebAssembly Front-End</strong>: interactive demos in the browser with WASM.</li>\n<li><strong>TUI Dashboard</strong>: live session metrics via <code class=\"language-text\">ratatui</code>.</li>\n<li><strong>QUIC Integration</strong>: embed quantum-safe IKEv2 into QUIC handshake.</li>\n</ul>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>Quantum Tunneler demonstrates that it is entirely feasible to implement a production-grade IPSec stack with <strong>post-quantum security</strong> in Rust. By modularizing the core cryptographic primitives, protocol logic, and user interface, the project provides a blueprint for next-generation secure networking—ready for the era of quantum adversaries. Contributions, feedback, and forks are highly encouraged!</p>",
            "url": "https://mayckongiovani.xyz/blog/quantum-tunneler",
            "title": "Quantum Tunneler: A Quantum-Safe IPSec Stack in Rust",
            "summary": "An in-depth technical deep-dive into Quantum Tunneler—an end-to-end, Rust-based implementation of a post-quantum IPSec stack leveraging Kyber and Falcon.",
            "date_modified": "2025-08-03T00:00:00.000Z",
            "tags": [
                "post-quantum-cryptography",
                "Rust",
                "IPSec",
                "cryptography",
                "no-std",
                "network-security"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-08-quantum-safe-vpn-design-lessons-from-implementing-a-pq-ipsec",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Quantum-Safe VPN Design: Lessons from Implementing a PQ IPSec Stack</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n<li>Assuming performance impacts will be negligible.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Design hybrid modes with explicit binding and observable outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational lessons relevant to rotation and recovery at scale.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — The standardization baseline for PQC readiness programs.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-08-quantum-safe-vpn-design-lessons-from-implementing-a-pq-ipsec",
            "title": "Quantum-Safe VPN Design: Lessons from Implementing a PQ IPSec Stack",
            "summary": "Threat-model-first analysis (August 2025): Quantum-Safe VPN Design: Lessons from Implementing a PQ IPSec Stack.",
            "date_modified": "2025-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/quantumsafe-finance-phase-2",
            "content_html": "<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/ea70d91179af4ca364008fd19d35e4e1/f1720/architecture.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 100%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAAsTAAALEwEAmpwYAAAC3UlEQVR42lWTCXOiQBCF/f//Zo1JNlvGxBzeay4jHkEUQRQvQE7B7H4DuuVWdWHPOK+P169zgesEnjBfOLtDso/3YRIFcRSG/i6JwyjweJPE+ySOvg/7MNgFrp1BcinMjgLXnOuXFxcP93fY00P57rZYuMgX8vny/V3x181jmd/b8l1pZRr70PNTfC6LQWx/Zw/70ufH23j0Neh1+Qz6EhfqeDSfaX2pO+xJ3c77ZrnwHSurN+c6lqaOF4YuD/vaRLE2S0OfUmGyjw5xeEjEF/Bcn3K/XBi8NDR1OlG8nZWzt6uZpk4UuZD/cXN9xS2ZOXKpyEMcgg56kjzotVuNZqPWqFV1dbKcG6Qh85ZXrUa9Xn1u1qutZl2RB7QQ+e5yPjPnM2gjYmq0IhFRHcv4AFPC0qf70IcJzLW3axpzbV0d0xHcrs0Fl17aII+FHQlzsznZmZHH0FUSQpX02Xl7acMhrUIHf9EL70Nvh53A7pFw8QdgTf2Ow+l49PP6slQsku1PHL2/tikVsICdpJE7R2ZRFzOd5MwTkob97nIxg2dIPocF/2U+A/NlmNZmBdWqMrLWy+3aBH+iTWHyHOn8DOw5UIIxUjqk+H630+t2OBKFUb+/viC10m0RIpCjvVnl/iWEY8ZAyIHURduQdHVZqD4/4qOt3ucHEWuVp2a9RjBE4GzXGdjeBx6RIBnl017KrlyrPMPTbDqBp6z4TIs425UJ8DhnbL0UBcIENdCz52yFSAxtZ224Ifp3EkEeCZlFHPoCnI3e0KbpOnQy3SIJZysIQ6pUxHG1MIjIG9jCoSkBhlXIoNrO2ytLQ4cpsSOQBFO+BugMJzvCGZoZDcWlY62Pi7FZLSpPjw/3pWnKM7Wwg+1W8+V386svARjLQ57VqxUIM9PFAigIE4d03WCMvjlSGF90sjbnMGQh7plGw9li0gJfsZKA2QosVezJ93fCUg1nfnYPbZjwAzfwnL+GRTsx+ph8lQAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"QuantumSafe Finance Architecture\"\n        title=\"\"\n        src=\"/static/ea70d91179af4ca364008fd19d35e4e1/39600/architecture.png\"\n        srcset=\"/static/ea70d91179af4ca364008fd19d35e4e1/1aaec/architecture.png 175w,\n/static/ea70d91179af4ca364008fd19d35e4e1/98287/architecture.png 350w,\n/static/ea70d91179af4ca364008fd19d35e4e1/39600/architecture.png 700w,\n/static/ea70d91179af4ca364008fd19d35e4e1/f1720/architecture.png 1024w\"\n        sizes=\"(max-width: 700px) 100vw, 700px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction</h2>\n<p>In 2025, we stand on the brink of a seismic shift in information security. <strong>Quantum computers</strong>, harnessing phenomena such as superposition and entanglement, threaten to undermine nearly all public-key cryptosystems in use today. At QuantumSafe Finance, we’re building an <strong>Open-Core</strong> framework that blends high-performance post-quantum primitives with an intelligent audit pipeline—allowing financial institutions to <em>prepare now</em> for a quantum future while maintaining compliance and performance.</p>\n<p>This article explores:</p>\n<ol>\n<li><strong>Why</strong> post-quantum cryptography (PQC) is essential for fintech and banking</li>\n<li>The <strong>threat models</strong> introduced by large-scale quantum hardware</li>\n<li>Our <strong>Phase 2 “Audit Lite”</strong> architecture and progress</li>\n<li>A <strong>deep technical dive</strong> into audit pipelines, ML anomaly detection, and rule engines</li>\n<li><strong>Integration examples</strong>, performance numbers, and next steps</li>\n</ol>\n<blockquote>\n<p>“The only secure computer is one that’s powered off, locked in a safe, and buried forty feet underground.”\n― Gene Spafford, paraphrased</p>\n<p><em>We’re not burying servers underground, but we are building tomorrow’s cryptographic defenses today.</em></p>\n</blockquote>\n<hr>\n<h2 id=\"1-why-post-quantum-cryptography-matters\" style=\"position:relative;\"><a href=\"#1-why-post-quantum-cryptography-matters\" aria-label=\"1 why post quantum cryptography matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1. Why Post-Quantum Cryptography Matters</h2>\n<h3 id=\"11-the-quantum-threat-model\" style=\"position:relative;\"><a href=\"#11-the-quantum-threat-model\" aria-label=\"11 the quantum threat model permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1.1 The Quantum Threat Model</h3>\n<ul>\n<li><strong>Shor’s algorithm</strong> (1994) runs in polynomial time on a sufficiently large quantum computer, breaking RSA, ECC, and discrete-log-based schemes in <em>seconds</em>.</li>\n<li><strong>Grover’s algorithm</strong> yields a quadratic speed-up for brute-force search, effectively halving symmetric key strength (e.g., AES-256 → AES-128 level).</li>\n</ul>\n<p>Financial systems rely on RSA/ECC for TLS handshakes, digital signatures, code signing, and blockchain consensus. A single fault in key management can cascade into massive breaches:</p>\n<ul>\n<li><strong>Transactional integrity</strong> is compromised when digital signatures become forgeable.</li>\n<li><strong>Data confidentiality</strong> fails when encrypted archives can be retroactively decrypted.</li>\n<li><strong>Regulatory penalties</strong> (GDPR, PCI DSS, GLBA) mount quickly once compromise is demonstrated.</li>\n</ul>\n<h3 id=\"12-industry-context\" style=\"position:relative;\"><a href=\"#12-industry-context\" aria-label=\"12 industry context permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>1.2 Industry Context</h3>\n<table>\n<thead>\n<tr>\n<th>Algorithm</th>\n<th>Classical Security</th>\n<th>Quantum-Resilient Alternative</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>RSA-2048</td>\n<td>~112-bit</td>\n<td>Kyber-512 (CSPR > 128-bit)</td>\n</tr>\n<tr>\n<td>ECC-P256</td>\n<td>~128-bit</td>\n<td>Dilithium-II (≥128-bit)</td>\n</tr>\n<tr>\n<td>HMAC-SHA2</td>\n<td>256-bit</td>\n<td>SHA2-256 w/ doubled key length</td>\n</tr>\n</tbody>\n</table>\n<p><em>PQC standards are finalized; NIST approved CRYSTALS-Kyber, Dilithium, Falcon, and SPHINCS+ in late 2024. Integration at scale remains the challenge.</em></p>\n<hr>\n<h2 id=\"2-phase-2--audit-lite-module\" style=\"position:relative;\"><a href=\"#2-phase-2--audit-lite-module\" aria-label=\"2 phase 2  audit lite module permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2. Phase 2 – “Audit Lite” Module</h2>\n<p>We’ve completed <strong>Phase 1</strong> (core PQC Rust engine, multi-language bindings, TLS sidecar PoC). Now in <strong>Phase 2</strong>, we’re delivering:</p>\n<ul>\n<li><strong>Real-time log ingestion</strong> (Kafka → Elasticsearch)</li>\n<li><strong>Lightweight rule engine</strong> (YARA-like syntax) for compliance checks</li>\n<li><strong>ML anomaly detection</strong> for cryptographic API misuse</li>\n<li><strong>Minimal dashboard</strong> with alert visualization and PDF reporting</li>\n</ul>\n<h3 id=\"21-goals--scope\" style=\"position:relative;\"><a href=\"#21-goals--scope\" aria-label=\"21 goals  scope permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>2.1 Goals &#x26; Scope</h3>\n<ol>\n<li><strong>Detect misuse patterns</strong> such as\n<ul>\n<li>Unusually large payloads</li>\n<li>Signing requests outside business hours</li>\n<li>Repeated key-encapsulation failures</li>\n</ul>\n</li>\n<li><strong>Automate regulatory compliance</strong> checks (PCI DSS, ISO 27001, LGPD)</li>\n<li><strong>Minimize operational overhead</strong>: add &#x3C; 1 ms per transaction, scale to 5 K TPS per node</li>\n</ol>\n<hr>\n<h2 id=\"3-technical-deep-dive\" style=\"position:relative;\"><a href=\"#3-technical-deep-dive\" aria-label=\"3 technical deep dive permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3. Technical Deep Dive</h2>\n<h3 id=\"31-log-ingestion-pipeline\" style=\"position:relative;\"><a href=\"#31-log-ingestion-pipeline\" aria-label=\"31 log ingestion pipeline permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3.1 Log Ingestion Pipeline</h3>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token comment\"># Helm values for Audit Lite deployment</span>\n<span class=\"token key atrule\">audit</span><span class=\"token punctuation\">:</span>\n  <span class=\"token key atrule\">enabled</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span>\n  <span class=\"token key atrule\">kafka</span><span class=\"token punctuation\">:</span>\n    <span class=\"token key atrule\">brokers</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> kafka1<span class=\"token punctuation\">:</span><span class=\"token number\">9092</span>\n      <span class=\"token punctuation\">-</span> kafka2<span class=\"token punctuation\">:</span><span class=\"token number\">9092</span>\n    <span class=\"token key atrule\">topic</span><span class=\"token punctuation\">:</span> pqc<span class=\"token punctuation\">-</span>logs\n  <span class=\"token key atrule\">elasticsearch</span><span class=\"token punctuation\">:</span>\n    <span class=\"token key atrule\">hosts</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> es1<span class=\"token punctuation\">:</span><span class=\"token number\">9200</span>\n      <span class=\"token punctuation\">-</span> es2<span class=\"token punctuation\">:</span><span class=\"token number\">9200</span></code></pre></div>\n<ol>\n<li>\n<p><strong>Producers</strong> (sidecar + core engine) emit structured JSON logs:</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"timestamp\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"2025-08-03T12:45:23Z\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"component\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"pqc-engine\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"operation\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"sign\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"algorithm\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Dilithium-II\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"duration_ms\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.45</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"status\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"OK\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"client_id\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"accounting-service\"</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n</li>\n<li>\n<p><strong>Kafka</strong> provides durable buffering and partitioned scale.</p>\n</li>\n<li>\n<p><strong>Logstash</strong> (or custom Python consumer) transforms and pushes to <strong>Elasticsearch</strong> indices with time-based sharding.</p>\n</li>\n</ol>\n<h3 id=\"32-rule-engine-yara-like\" style=\"position:relative;\"><a href=\"#32-rule-engine-yara-like\" aria-label=\"32 rule engine yara like permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3.2 Rule Engine (YARA-like)</h3>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token comment\"># Example rule</span>\n<span class=\"token key atrule\">rules</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">id</span><span class=\"token punctuation\">:</span> late<span class=\"token punctuation\">-</span>night<span class=\"token punctuation\">-</span>signs\n    <span class=\"token key atrule\">description</span><span class=\"token punctuation\">:</span> <span class=\"token string\">\"Signing operations between 02:00–04:00 UTC\"</span>\n    <span class=\"token key atrule\">condition</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">|</span><span class=\"token scalar string\">\n      operation == \"sign\" &amp;&amp;\n      (hour(timestamp) >= 2 &amp;&amp; hour(timestamp) &lt; 4)</span></code></pre></div>\n<ul>\n<li>Written in simple declarative YAML.</li>\n<li>Engine runs as part of ingestion, tagging documents with rule hits.</li>\n<li>Alerts emitted to message bus (Slack webhook, email, or webhook endpoint).</li>\n</ul>\n<h3 id=\"33-ml-driven-anomaly-detection\" style=\"position:relative;\"><a href=\"#33-ml-driven-anomaly-detection\" aria-label=\"33 ml driven anomaly detection permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3.3 ML-Driven Anomaly Detection</h3>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token comment\"># Simplified example: Isolation Forest on duration_ms</span>\n<span class=\"token keyword\">from</span> sklearn<span class=\"token punctuation\">.</span>ensemble <span class=\"token keyword\">import</span> IsolationForest\nmodel <span class=\"token operator\">=</span> IsolationForest<span class=\"token punctuation\">(</span>contamination<span class=\"token operator\">=</span><span class=\"token number\">0.01</span><span class=\"token punctuation\">)</span>\nX <span class=\"token operator\">=</span> load_feature_matrix<span class=\"token punctuation\">(</span>index<span class=\"token operator\">=</span><span class=\"token string\">\"pqc-logs-*\"</span><span class=\"token punctuation\">,</span> features<span class=\"token operator\">=</span><span class=\"token punctuation\">[</span><span class=\"token string\">\"duration_ms\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"payload_size\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span>\nmodel<span class=\"token punctuation\">.</span>fit<span class=\"token punctuation\">(</span>X<span class=\"token punctuation\">)</span>\nanomalies <span class=\"token operator\">=</span> model<span class=\"token punctuation\">.</span>predict<span class=\"token punctuation\">(</span>X<span class=\"token punctuation\">)</span>  <span class=\"token comment\"># -1 indicates anomaly</span></code></pre></div>\n<ul>\n<li>\n<p><strong>Features</strong>:</p>\n<ul>\n<li><code class=\"language-text\">duration_ms</code></li>\n<li><code class=\"language-text\">payload_size_bytes</code></li>\n<li><code class=\"language-text\">failure_rate</code> per client</li>\n</ul>\n</li>\n<li>\n<p><strong>Pipeline</strong>:</p>\n<ol>\n<li>Batch-train nightly on rolling window (7 days)</li>\n<li>Serve model via lightweight REST (FastAPI)</li>\n<li>Score live log events; anomalies → alert stream</li>\n</ol>\n</li>\n</ul>\n<h3 id=\"34-dashboard--reports\" style=\"position:relative;\"><a href=\"#34-dashboard--reports\" aria-label=\"34 dashboard  reports permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>3.4 Dashboard &#x26; Reports</h3>\n<div class=\"gatsby-highlight\" data-language=\"html\"><pre class=\"language-html\"><code class=\"language-html\"><span class=\"token comment\">&lt;!-- React snippet: rendering alert counts --></span>\n&lt;AlertChart\n  data={fetch(\"/api/audit/alerts?range=24h\")}\n  xKey=\"rule_id\"\n  yKey=\"count\"\n/></code></pre></div>\n<ul>\n<li><strong>React + D3.js</strong> for interactive visualization.</li>\n<li><strong>Node.js</strong> backend generates scheduled PDF/CSV reports via Puppeteer.</li>\n</ul>\n<hr>\n<h2 id=\"4-integration-example\" style=\"position:relative;\"><a href=\"#4-integration-example\" aria-label=\"4 integration example permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>4. Integration Example</h2>\n<p>Developers can integrate Audit Lite with a few YAML lines:</p>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token key atrule\">quantumsafe</span><span class=\"token punctuation\">:</span>\n  <span class=\"token key atrule\">pqcSidecar</span><span class=\"token punctuation\">:</span>\n    <span class=\"token key atrule\">image</span><span class=\"token punctuation\">:</span> quantumsafe/pqc<span class=\"token punctuation\">-</span>sidecar<span class=\"token punctuation\">:</span>2.0.0\n    <span class=\"token key atrule\">args</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>audit<span class=\"token punctuation\">-</span>topic=pqc<span class=\"token punctuation\">-</span>logs\n  <span class=\"token key atrule\">auditLite</span><span class=\"token punctuation\">:</span>\n    <span class=\"token key atrule\">enabled</span><span class=\"token punctuation\">:</span> <span class=\"token boolean important\">true</span>\n    <span class=\"token key atrule\">rulesFile</span><span class=\"token punctuation\">:</span> /etc/quantumsafe/rules.yaml</code></pre></div>\n<p><em>In Kubernetes:</em> deploy as two containers in the same Pod (sidecar + audit service). No code changes required in the application.</p>\n<hr>\n<h2 id=\"5-performance--scaling\" style=\"position:relative;\"><a href=\"#5-performance--scaling\" aria-label=\"5 performance  scaling permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>5. Performance &#x26; Scaling</h2>\n<table>\n<thead>\n<tr>\n<th>Metric</th>\n<th>Measured Result</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Sidecar handshake overhead</td>\n<td>0.5 ms ± 0.1 ms</td>\n</tr>\n<tr>\n<td>Audit pipeline end-to-end latency</td>\n<td>8 ms (median)</td>\n</tr>\n<tr>\n<td>ML model inference time</td>\n<td>1.2 ms per event</td>\n</tr>\n<tr>\n<td>Horizontal scaling</td>\n<td>10K events/s per instance</td>\n</tr>\n</tbody>\n</table>\n<p><em>Linear scaling demonstrated up to 100K events/s across a 10-node cluster.</em></p>\n<hr>\n<h2 id=\"6-next-steps--roadmap\" style=\"position:relative;\"><a href=\"#6-next-steps--roadmap\" aria-label=\"6 next steps  roadmap permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>6. Next Steps &#x26; Roadmap</h2>\n<ol>\n<li>\n<p><strong>Phase 3</strong> – Full Enterprise Modules</p>\n<ul>\n<li>Pre-trained ML packs, advanced rule templating, HSM adapters.</li>\n</ul>\n</li>\n<li>\n<p><strong>Phase 4</strong> – Certification &#x26; Compliance Tooling</p>\n<ul>\n<li>Automated PCI DSS audit reports, LGPD data-privacy workflows.</li>\n</ul>\n</li>\n<li>\n<p><strong>Phase 5</strong> – Ecosystem &#x26; Marketplace</p>\n<ul>\n<li>Plugin marketplace for third-party compliance packs and connectors.</li>\n</ul>\n</li>\n</ol>\n<hr>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>Phase 2 represents a crucial milestone: <strong>enabling intelligent, automated auditing</strong> alongside quantum-safe cryptography. By addressing both the cryptographic threat and operational compliance, we position QuantumSafe Finance as a research-driven, production-ready framework—poised to become the standard for financial institutions navigating the quantum era.</p>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token comment\"># Quick reference: Phase status</span>\n<span class=\"token key atrule\">phase</span><span class=\"token punctuation\">:</span> <span class=\"token number\">2</span>\n<span class=\"token key atrule\">core</span><span class=\"token punctuation\">:</span> complete\n<span class=\"token key atrule\">auditLite</span><span class=\"token punctuation\">:</span> in<span class=\"token punctuation\">-</span>development\n<span class=\"token key atrule\">enterpriseModules</span><span class=\"token punctuation\">:</span> pending</code></pre></div>\n<hr>",
            "url": "https://mayckongiovani.xyz/pensieve/quantumsafe-finance-phase-2",
            "title": "QuantumSafe Finance – Deep Technical Overview (Phase 2)",
            "summary": "Comprehensive article on the motivations, architecture, and current Phase 2 development of the QuantumSafe Finance Open-Core PQC platform.",
            "date_modified": "2025-08-01T00:00:00.000Z",
            "tags": [
                "post-quantum",
                "cryptography",
                "fintech",
                "audit"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-07-no-std-crypto-in-rust-determinism-side-channels-and-constrai",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>no_std Crypto in Rust: Determinism, Side Channels, and Constraints</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Define success metrics beyond “enabled”: cohorts, failures, and evidence.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on ‘automatic’ negotiation without downgrade resistance.</li>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Risk is a function of exposure and lifetime:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo>≈</mo><mrow><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{risk} \\approx \\mathrm{exposure} \\times \\mathrm{lifetime} \\times \\mathrm{adversary\\_capability}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">risk</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">exposure</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.0833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">lifetime</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">adversary_capability</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  threat<span class=\"token text string\">[\"Threat Model (quantum + classical)\"]</span> <span class=\"token arrow operator\">--></span> design<span class=\"token text string\">[\"Protocol Design\"]</span>\n  design <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (no_std where needed)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> verify<span class=\"token text string\">[\"Verification (tests + formal)\"]</span>\n  verify <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Operationalization (rotation + monitoring)\"]</span>\n  ops <span class=\"token arrow operator\">--></span> threat</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Operationalize early: rollback and monitoring are part of the design.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--1\">(<a href=\"#bib-rfc8446\">1</a>)</span> — A useful reference for handshake structure and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-07-no-std-crypto-in-rust-determinism-side-channels-and-constrai",
            "title": "no_std Crypto in Rust: Determinism, Side Channels, and Constraints",
            "summary": "Engineering notebook entry (July 2025): no_std Crypto in Rust: Determinism, Side Channels, and Constraints.",
            "date_modified": "2025-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/neurotradex-architecture",
            "content_html": "<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 700px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/de26140bfe60ea1da24683aa7843508f/437a1/neurotradex-diagram.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 66.85714285714286%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAAsTAAALEwEAmpwYAAABqklEQVR42p2S226bQBRF+f9falLJdZIHy0qLYlm+UWAwNwsQDAy2xzZ0McSOKvWp+2E49zl7M1Zn0Pd90zRSyrZty7JqmrqqOAeUZUl8tLXWVHZ3WI9mz/Ofn7/P5/P395/T6cu3pyfbtrF/TKeTyWQ2m72+vcVx/Ffz9Xo9a30xYDAuafyrwcUYRG6320UPtjbAGJplXYdh6Pt+GEX7MCyKQinlCxEaBEFA6nQ6HQ6HKI5FEHC553lQYKJV1zULf3wstrud63kUZVm+2Wwc57fjOMvlcrvdykoKETBxtVp5vk+2UWpoPp/Pqm0rKZMkQS1cokRAmqZsgTEQ0Xooq6o8z9W9zBrVIkdi5EaEk/WE8Fkb2qNInMfjkU0fmlnUwZ4obG8G4yzESpKYm/VFj0MBC+ZFQdunYEyKogg+MN/v92zFnkQ810UFtHFdl7+RpgcMXISAszT3WzwA/F+2vVgs1us1/VmWwR+dcHeo6Lq8k1F2IQQuwU+1oc7laNC0Ssp6VKJpFGl2rs1JBOaUje8MQxshrK4fpOjMp/t6PIM8D/w70t+f5//hD3tR3zj4HJltAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"NeuroTradeX Architecture\"\n        title=\"\"\n        src=\"/static/de26140bfe60ea1da24683aa7843508f/39600/neurotradex-diagram.png\"\n        srcset=\"/static/de26140bfe60ea1da24683aa7843508f/1aaec/neurotradex-diagram.png 175w,\n/static/de26140bfe60ea1da24683aa7843508f/98287/neurotradex-diagram.png 350w,\n/static/de26140bfe60ea1da24683aa7843508f/39600/neurotradex-diagram.png 700w,\n/static/de26140bfe60ea1da24683aa7843508f/57cd1/neurotradex-diagram.png 1050w,\n/static/de26140bfe60ea1da24683aa7843508f/4af54/neurotradex-diagram.png 1400w,\n/static/de26140bfe60ea1da24683aa7843508f/437a1/neurotradex-diagram.png 1536w\"\n        sizes=\"(max-width: 700px) 100vw, 700px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n        decoding=\"async\"\n      />\n  </a>\n    </span></p>\n<blockquote>\n<p>NeuroTradeX is an advanced, modular trading platform designed for real-time, explainable AI in financial and crypto markets.\nIt was built with a focus on transparency, security, extensibility, and performance — combining technologies like LSTM, Transformers, SHAP, WebSocket streaming, Dockerized services, and real exchange integrations.</p>\n</blockquote>\n<hr>\n<h2 id=\"️-system-overview\" style=\"position:relative;\"><a href=\"#%EF%B8%8F-system-overview\" aria-label=\"️ system overview permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>⚙️ System Overview</h2>\n<p>At its core, <strong>NeuroTradeX</strong> is composed of 5 decoupled services:</p>\n<ol>\n<li><code class=\"language-text\">data-core</code>: feature pipelines, OHLCV ingestion, sentiment processing via LLMs</li>\n<li><code class=\"language-text\">model-engine</code>: deep learning prediction using LSTM, Transformer, and SHAP explanations</li>\n<li><code class=\"language-text\">exec-core</code>: real or simulated execution (Binance, paper trading), with risk controls</li>\n<li><code class=\"language-text\">dashboard-ui</code>: live Next.js UI to monitor model confidence, signal history, logs</li>\n<li><code class=\"language-text\">alert-system</code>: async, multi-channel alerts via Telegram, Discord, and Webhooks</li>\n</ol>\n<p>The entire system is open-source and hosted at:\n🔗 <a href=\"https://gitlab.com/neurotradex\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><code class=\"language-text\">gitlab.com/neurotradex</code></a></p>\n<hr>\n<h2 id=\"-modular-architecture\" style=\"position:relative;\"><a href=\"#-modular-architecture\" aria-label=\" modular architecture permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🧱 Modular Architecture</h2>\n<p>Each module runs independently, communicates through structured JSON files or WebSocket streams, and is deployable via Docker Compose or Kubernetes.</p>\n<hr>\n<h2 id=\"-data-pipeline-highlights\" style=\"position:relative;\"><a href=\"#-data-pipeline-highlights\" aria-label=\" data pipeline highlights permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>📊 Data Pipeline Highlights</h2>\n<p>The <code class=\"language-text\">data-core</code> module is responsible for ingesting:</p>\n<ul>\n<li>\n<p><strong>OHLCV data</strong> from Binance/Bybit</p>\n</li>\n<li>\n<p><strong>Sentiment/news data</strong> from CoinDesk, Yahoo, Twitter</p>\n</li>\n<li>\n<p>Feature engineering with <code class=\"language-text\">ta-lib</code>, including:</p>\n<ul>\n<li>RSI, MACD, Bollinger Bands, OBV, ATR, and custom signals</li>\n</ul>\n</li>\n<li>\n<p>Embedding of textual data using <code class=\"language-text\">sentence-transformers</code> and <code class=\"language-text\">LLMs</code></p>\n</li>\n</ul>\n<div class=\"gatsby-code-title\">technicals.py</div>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">def</span> <span class=\"token function\">compute_macd</span><span class=\"token punctuation\">(</span>df<span class=\"token punctuation\">)</span><span class=\"token punctuation\">:</span>\n    macd <span class=\"token operator\">=</span> df<span class=\"token punctuation\">[</span><span class=\"token string\">'close'</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">.</span>ewm<span class=\"token punctuation\">(</span>span<span class=\"token operator\">=</span><span class=\"token number\">12</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>mean<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">-</span> df<span class=\"token punctuation\">[</span><span class=\"token string\">'close'</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">.</span>ewm<span class=\"token punctuation\">(</span>span<span class=\"token operator\">=</span><span class=\"token number\">26</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>mean<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n    signal <span class=\"token operator\">=</span> macd<span class=\"token punctuation\">.</span>ewm<span class=\"token punctuation\">(</span>span<span class=\"token operator\">=</span><span class=\"token number\">9</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>mean<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n    <span class=\"token keyword\">return</span> macd<span class=\"token punctuation\">,</span> signal</code></pre></div>\n<hr>\n<h2 id=\"-ai-modeling-model-engine\" style=\"position:relative;\"><a href=\"#-ai-modeling-model-engine\" aria-label=\" ai modeling model engine permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🧠 AI Modeling: <code class=\"language-text\">model-engine</code></h2>\n<p>This module provides both supervised learning and interpretable AI via:</p>\n<ul>\n<li><strong>LSTM</strong> and <strong>Autoformer</strong> for time series prediction</li>\n<li><strong>SHAP values</strong> and <strong>LIME</strong> for feature attribution</li>\n<li>Support for both:\n<ul>\n<li>static offline training</li>\n<li>or online/streaming signal classification</li>\n</ul>\n</li>\n</ul>\n<div class=\"gatsby-code-title\">shap_wrapper.py</div>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\">explainer <span class=\"token operator\">=</span> shap<span class=\"token punctuation\">.</span>Explainer<span class=\"token punctuation\">(</span>model<span class=\"token punctuation\">,</span> sample_data<span class=\"token punctuation\">)</span>\nshap_values <span class=\"token operator\">=</span> explainer<span class=\"token punctuation\">(</span>data_point<span class=\"token punctuation\">)</span>\nshap<span class=\"token punctuation\">.</span>plots<span class=\"token punctuation\">.</span>waterfall<span class=\"token punctuation\">(</span>shap_values<span class=\"token punctuation\">[</span><span class=\"token number\">0</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span></code></pre></div>\n<p>All models export signal objects in a common schema for consumption by the <code class=\"language-text\">exec-core</code>.</p>\n<hr>\n<h2 id=\"️-execution-engine-exec-core\" style=\"position:relative;\"><a href=\"#%EF%B8%8F-execution-engine-exec-core\" aria-label=\"️ execution engine exec core permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🛡️ Execution Engine: <code class=\"language-text\">exec-core</code></h2>\n<p>Built with security and precision in mind, this module handles:</p>\n<ul>\n<li>Signal validation</li>\n<li>Risk checking (drawdown cap, dynamic sizing)</li>\n<li>Execution via real APIs (Binance) or paper simulation</li>\n<li>CLI and Telegram fallback approvals</li>\n</ul>\n<div class=\"gatsby-code-title\">trade_executor.py</div>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">if</span> risk_manager<span class=\"token punctuation\">.</span>validate<span class=\"token punctuation\">(</span>signal<span class=\"token punctuation\">)</span><span class=\"token punctuation\">:</span>\n    executor<span class=\"token punctuation\">.</span>place_order<span class=\"token punctuation\">(</span>signal<span class=\"token punctuation\">.</span>asset<span class=\"token punctuation\">,</span> signal<span class=\"token punctuation\">.</span>side<span class=\"token punctuation\">,</span> size<span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">else</span><span class=\"token punctuation\">:</span>\n    fallback<span class=\"token punctuation\">.</span>notify<span class=\"token punctuation\">(</span>signal<span class=\"token punctuation\">,</span> reason<span class=\"token operator\">=</span><span class=\"token string\">\"risk_threshold_breached\"</span><span class=\"token punctuation\">)</span></code></pre></div>\n<p>Trade logs and decisions are timestamped and persisted locally.</p>\n<hr>\n<h2 id=\"-ui-dashboard-ui\" style=\"position:relative;\"><a href=\"#-ui-dashboard-ui\" aria-label=\" ui dashboard ui permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>📺 UI: <code class=\"language-text\">dashboard-ui</code></h2>\n<p>Written in <strong>Next.js + Tailwind</strong>, the dashboard:</p>\n<ul>\n<li>Streams signal flow and execution feedback</li>\n<li>Shows confidence metrics and model explanations</li>\n<li>Uses <code class=\"language-text\">TradingView</code> for OHLCV chart overlays</li>\n<li>Offers real-time logs and theming (dark/light)</li>\n</ul>\n<div class=\"gatsby-code-title\">LiveChart.tsx</div>\n<div class=\"gatsby-highlight\" data-language=\"tsx\"><pre class=\"language-tsx\"><code class=\"language-tsx\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">LightweightChart</span></span>\n  <span class=\"token attr-name\">data</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>ohlcv<span class=\"token punctuation\">}</span></span>\n  <span class=\"token attr-name\">signals</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>executedSignals<span class=\"token punctuation\">}</span></span>\n  <span class=\"token attr-name\">overlays</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>shapAttributions<span class=\"token punctuation\">}</span></span>\n<span class=\"token punctuation\">/></span></span></code></pre></div>\n<hr>\n<h2 id=\"-real-time-notifications-alert-system\" style=\"position:relative;\"><a href=\"#-real-time-notifications-alert-system\" aria-label=\" real time notifications alert system permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🔔 Real-Time Notifications: <code class=\"language-text\">alert-system</code></h2>\n<p>This service asynchronously pushes alerts to:</p>\n<ul>\n<li>Telegram channels</li>\n<li>Discord webhooks</li>\n<li>Any custom webhook endpoint</li>\n</ul>\n<p>It uses <code class=\"language-text\">jinja2</code> templating, retries, exponential backoff, and tokenized configs via <code class=\"language-text\">.env</code>.</p>\n<div class=\"gatsby-code-title\">telegram_alert.py</div>\n<div class=\"gatsby-highlight\" data-language=\"python\"><pre class=\"language-python\"><code class=\"language-python\"><span class=\"token keyword\">def</span> <span class=\"token function\">send</span><span class=\"token punctuation\">(</span>signal<span class=\"token punctuation\">:</span> TradeSignal<span class=\"token punctuation\">)</span><span class=\"token punctuation\">:</span>\n    message <span class=\"token operator\">=</span> render_template<span class=\"token punctuation\">(</span><span class=\"token string\">\"signal_message.md\"</span><span class=\"token punctuation\">,</span> signal<span class=\"token punctuation\">)</span>\n    bot<span class=\"token punctuation\">.</span>send_message<span class=\"token punctuation\">(</span>chat_id<span class=\"token operator\">=</span>chat<span class=\"token punctuation\">,</span> text<span class=\"token operator\">=</span>message<span class=\"token punctuation\">,</span> parse_mode<span class=\"token operator\">=</span><span class=\"token string\">\"Markdown\"</span><span class=\"token punctuation\">)</span></code></pre></div>\n<p>Logs are grouped by date in <code class=\"language-text\">/logs/alerts/YYYY-MM-DD.log</code>.</p>\n<hr>\n<h2 id=\"-testing--cicd\" style=\"position:relative;\"><a href=\"#-testing--cicd\" aria-label=\" testing  cicd permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🧪 Testing &#x26; CI/CD</h2>\n<p>Each module is:</p>\n<ul>\n<li>Fully unit-tested via <code class=\"language-text\">pytest</code> or <code class=\"language-text\">jest</code></li>\n<li>Integrated into <code class=\"language-text\">.gitlab-ci.yml</code> for linting, security checks, and test execution</li>\n<li>Built for containerized environments with Docker and optional support for Kubernetes Helm charts</li>\n</ul>\n<hr>\n<h2 id=\"-final-thoughts\" style=\"position:relative;\"><a href=\"#-final-thoughts\" aria-label=\" final thoughts permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>🌍 Final Thoughts</h2>\n<p>Developing NeuroTradeX was an exercise in bringing together:</p>\n<ul>\n<li><strong>Machine learning</strong></li>\n<li><strong>Financial engineering</strong></li>\n<li><strong>Distributed systems</strong></li>\n<li><strong>Explainability</strong></li>\n<li><strong>Human-in-the-loop design</strong></li>\n</ul>\n<p>Its open-source nature allows contributors, researchers, and traders to explore, extend, and build upon a transparent architecture built for reliability and real-world applicability.</p>\n<p>Whether you're working in DeFi, TradFi, or AI-driven quantitative systems, NeuroTradeX provides a foundation ready to grow.</p>\n<blockquote>\n<p><em>Repository: <a href=\"https://gitlab.com/neurotradex\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">gitlab.com/neurotradex</a></em></p>\n</blockquote>\n<hr>",
            "url": "https://mayckongiovani.xyz/pensieve/neurotradex-architecture",
            "title": "Building NeuroTradeX — Architecting an AI-Driven Trading System",
            "summary": "A deep-dive into the modular design, architecture, and implementation of the NeuroTradeX open-source platform for financial and crypto trading.",
            "date_modified": "2025-06-18T00:00:00.000Z",
            "tags": [
                "AI",
                "Trading",
                "Crypto",
                "Fintech",
                "Engineering",
                "Rust",
                "Python"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-06-bft-with-pq-primitives-when-crypto-costs-dominate",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>BFT with PQ Primitives: When Crypto Costs Dominate</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Define success metrics beyond “enabled”: cohorts, failures, and evidence.</li>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n<li>Assuming performance impacts will be negligible.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Operationalize early: rollback and monitoring are part of the design.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Operational lessons relevant to rotation and recovery at scale.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-06-bft-with-pq-primitives-when-crypto-costs-dominate",
            "title": "BFT with PQ Primitives: When Crypto Costs Dominate",
            "summary": "Spec-driven research note (June 2025): BFT with PQ Primitives: When Crypto Costs Dominate.",
            "date_modified": "2025-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-05-quantum-resilient-identity-device-human-online-offline",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Quantum-Resilient Identity: Device + Human, Online + Offline</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Define success metrics beyond “enabled”: cohorts, failures, and evidence.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n<li>Relying on ‘automatic’ negotiation without downgrade resistance.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>PQ readiness is a systems program: crypto, networking, ops, and UX must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-05-quantum-resilient-identity-device-human-online-offline",
            "title": "Quantum-Resilient Identity: Device + Human, Online + Offline",
            "summary": "Adversarial-first deep dive (May 2025): Quantum-Resilient Identity: Device + Human, Online + Offline.",
            "date_modified": "2025-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/cpzkp-chaum-pedersen-zkp",
            "content_html": "<p><img src=\"./cpzkp-banner.jpg\" alt=\"CPZKp Banner\"></p>\n<blockquote>\n<p>“You don’t start with ZK. ZK starts with you.” — someone probably</p>\n</blockquote>\n<h2 id=\"introduction\" style=\"position:relative;\"><a href=\"#introduction\" aria-label=\"introduction permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Introduction</h2>\n<p>In late 2023, the seed for CPZKp was planted: a lightweight, modular, and no-bullshit Rust library for zero-knowledge proofs using the Chaum-Pedersen protocol. The motivation was personal and practical — to build a foundation that respects cryptographic rigor, while remaining usable in real-world systems, especially those relying on elliptic curve cryptography (ECC).</p>\n<p>This post is not a “hello world.” It’s a journey — from group theory to Curve25519 bindings, from low-level proof serialization to full WASM exports. If you're looking for a project that goes from first principles to full-stack cryptography, buckle up.</p>\n<hr>\n<h2 id=\"motivation\" style=\"position:relative;\"><a href=\"#motivation\" aria-label=\"motivation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Motivation</h2>\n<p>By 2023, a few realities had become clear:</p>\n<ol>\n<li>Most zero-knowledge implementations are either academic toys or tightly bound to specific use cases (blockchains, zkSNARKs, etc).</li>\n<li>Libraries like <code class=\"language-text\">bulletproofs</code> or <code class=\"language-text\">zkcrypto</code> are excellent, but bloated when you need just authentication proofs.</li>\n<li>There was no ergonomic, extensible, and no_std-capable Chaum-Pedersen implementation in Rust.</li>\n</ol>\n<blockquote>\n<p>CPZKp was born from frustration — and fascination.</p>\n</blockquote>\n<hr>\n<h2 id=\"what-is-the-chaum-pedersen-zkp\" style=\"position:relative;\"><a href=\"#what-is-the-chaum-pedersen-zkp\" aria-label=\"what is the chaum pedersen zkp permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is the Chaum-Pedersen ZKP?</h2>\n<p>It’s a proof of equality of discrete logs:\nIf you know <code class=\"language-text\">x</code> such that <code class=\"language-text\">g^x = A</code> and <code class=\"language-text\">h^x = B</code>, you can prove knowledge of <code class=\"language-text\">x</code> without revealing it.</p>\n<p>This is essential in:</p>\n<ul>\n<li>Secure authentication (no password ever transmitted)</li>\n<li>Key exchange validation</li>\n<li>Voting and threshold cryptography</li>\n</ul>\n<p>The challenge was: how do we express this cleanly across scalar groups and ECC, and still support Curve25519?</p>\n<hr>\n<h2 id=\"designing-the-library\" style=\"position:relative;\"><a href=\"#designing-the-library\" aria-label=\"designing the library permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Designing the Library</h2>\n<p>We started with a few key design principles:</p>\n<h3 id=\"protocols-as-traits\" style=\"position:relative;\"><a href=\"#protocols-as-traits\" aria-label=\"protocols as traits permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Protocols as Traits</h3>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">ZkpProtocol</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Secret</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Public</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Proof</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">prove</span><span class=\"token punctuation\">(</span>secret<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Secret</span><span class=\"token punctuation\">,</span> pub_input<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Public</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Proof</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">verify</span><span class=\"token punctuation\">(</span>public<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Public</span><span class=\"token punctuation\">,</span> proof<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Proof</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Protocols are swappable. This allows for different backends (<code class=\"language-text\">secp256k1</code>, <code class=\"language-text\">Ristretto</code>, <code class=\"language-text\">ScalarGroup</code>) and experimentation with variants.</p>\n<h3 id=\"scalar-and-ecc-support\" style=\"position:relative;\"><a href=\"#scalar-and-ecc-support\" aria-label=\"scalar and ecc support permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Scalar and ECC Support</h3>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">mod</span> <span class=\"token module-declaration namespace\">scalar</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">mod</span> <span class=\"token module-declaration namespace\">ecc</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Internally, both conform to common traits like <code class=\"language-text\">GroupElement</code>, enabling unified logic in proof generators and verifiers.</p>\n<hr>\n<h2 id=\"serialization-making-proofs-portable\" style=\"position:relative;\"><a href=\"#serialization-making-proofs-portable\" aria-label=\"serialization making proofs portable permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Serialization: Making Proofs Portable</h2>\n<p>One key requirement was to serialize proofs for transmission.</p>\n<p>We used <code class=\"language-text\">serde</code> and implemented robust custom serialization for scalar and ECC formats:</p>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Serialize, Deserialize)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">ChaumPedersenProof</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">pub</span> t1<span class=\"token punctuation\">:</span> <span class=\"token class-name\">GroupElement</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> t2<span class=\"token punctuation\">:</span> <span class=\"token class-name\">GroupElement</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> challenge<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Scalar</span><span class=\"token punctuation\">,</span>\n    <span class=\"token keyword\">pub</span> response<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Scalar</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>This allowed JSON/web compatibility from day one.</p>\n<hr>\n<h2 id=\"testing-the-unprovable\" style=\"position:relative;\"><a href=\"#testing-the-unprovable\" aria-label=\"testing the unprovable permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Testing the Unprovable</h2>\n<p>We didn’t stop at unit tests. CPZKp includes:</p>\n<ul>\n<li>🔁 Property-based tests (<code class=\"language-text\">proptest</code>)</li>\n<li>🧪 Negative tests (e.g., corrupt challenge / invalid response)</li>\n<li>🧬 Deterministic regression seeds for CI stability</li>\n<li>🔍 Manual validation of group assumptions</li>\n</ul>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token macro property\">proptest!</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token attribute attr-name\">#[test]</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">prove_and_verify_should_hold</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">ref</span> s <span class=\"token keyword\">in</span> <span class=\"token function\">any</span><span class=\"token punctuation\">::</span><span class=\"token operator\">&lt;</span><span class=\"token class-name\">Scalar</span><span class=\"token operator\">></span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n        <span class=\"token keyword\">let</span> <span class=\"token punctuation\">(</span>pk<span class=\"token punctuation\">,</span> proof<span class=\"token punctuation\">)</span> <span class=\"token operator\">=</span> <span class=\"token class-name\">ChaumPedersen</span><span class=\"token punctuation\">::</span><span class=\"token function\">prove</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>s<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n        <span class=\"token macro property\">prop_assert!</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">ChaumPedersen</span><span class=\"token punctuation\">::</span><span class=\"token function\">verify</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>pk<span class=\"token punctuation\">,</span> <span class=\"token operator\">&amp;</span>proof<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<hr>\n<h2 id=\"wasm-and-python-bindings\" style=\"position:relative;\"><a href=\"#wasm-and-python-bindings\" aria-label=\"wasm and python bindings permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>WASM and Python Bindings</h2>\n<p>We wanted this lib usable in:</p>\n<ul>\n<li>dApps (via WASM)</li>\n<li>Python systems (via <code class=\"language-text\">pyo3</code>)</li>\n</ul>\n<p>Result:</p>\n<ul>\n<li><code class=\"language-text\">wasm_bindgen</code> wrapper in <code class=\"language-text\">wasm.rs</code></li>\n<li><code class=\"language-text\">maturin</code> build in <code class=\"language-text\">bindings/python</code></li>\n</ul>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[wasm_bindgen]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">prove_json</span><span class=\"token punctuation\">(</span>sk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">str</span><span class=\"token punctuation\">,</span> pk<span class=\"token punctuation\">:</span> <span class=\"token operator\">&amp;</span><span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">String</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token punctuation\">...</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Now CPZKp runs in browsers and Jupyter notebooks.</p>\n<hr>\n<h2 id=\"cli-tool\" style=\"position:relative;\"><a href=\"#cli-tool\" aria-label=\"cli tool permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>CLI Tool</h2>\n<p>We implemented a command-line utility for quick usage:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">cpzkp gen-key\ncpzkp prove <span class=\"token parameter variable\">--msg</span> <span class=\"token string\">\"authenticate me\"</span>\ncpzkp verify <span class=\"token parameter variable\">--proof</span> proof.json</code></pre></div>\n<p>Backed by <code class=\"language-text\">clap</code>, this made it ideal for scripting, automation, or even classroom demos.</p>\n<hr>\n<h2 id=\"performance\" style=\"position:relative;\"><a href=\"#performance\" aria-label=\"performance permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Performance</h2>\n<p>Benchmarks were done using <code class=\"language-text\">criterion</code>. Example:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">group                           time\nChaumPedersen_scalar_prove     1.2 µs\nChaumPedersen_ecc_prove        4.8 µs\nChaumPedersen_verify_scalar    0.9 µs\nChaumPedersen_verify_ecc       3.7 µs</code></pre></div>\n<p>Enough for embedded use and authentication services.</p>\n<hr>\n<h2 id=\"what-we-learned\" style=\"position:relative;\"><a href=\"#what-we-learned\" aria-label=\"what we learned permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What We Learned</h2>\n<ul>\n<li>Traits + generic cryptographic algebra = superpowers.</li>\n<li>Testing edge cases in ZKP is not optional — it’s life.</li>\n<li>Targeting WASM early saves time later.</li>\n<li>Your build scripts are part of your UX.</li>\n</ul>\n<hr>\n<h2 id=\"roadmap\" style=\"position:relative;\"><a href=\"#roadmap\" aria-label=\"roadmap permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Roadmap</h2>\n<ul>\n<li>🔒 Formal audit and fuzz testing</li>\n<li>📦 Publish to crates.io and PyPI</li>\n<li>🧱 Add Bulletproofs-style range proofs</li>\n<li>🔄 Add MPC-friendly APIs</li>\n<li>🌐 Playground (CPZKp + Monaco + WebWasm)</li>\n</ul>\n<hr>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h2>\n<p>CPZKp isn’t another toy crypto lib. It’s a usable, modular ZKP toolkit built from real-world needs, shaped by frustration, and delivered with love — in Rust.</p>\n<p>Try it. Break it. Extend it.</p>\n<hr>\n<p><a href=\"https://github.com/doomhammerhell/CPZKp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GitHub</a></p>",
            "url": "https://mayckongiovani.xyz/pensieve/cpzkp-chaum-pedersen-zkp",
            "title": "CPZKp - Building Practical Zero-Knowledge Proofs in Rust from Scratch",
            "summary": "A deep technical dive into the motivations, design, and implementation of CPZKp, a Chaum-Pedersen based ZK authentication library in Rust.",
            "date_modified": "2025-04-28T00:00:00.000Z",
            "tags": [
                "Rust",
                "cryptography",
                "zero-knowledge",
                "chaum-pedersen",
                "ecc",
                "curve25519",
                "security",
                "portfolio"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/pqc-iiot-post-quantum-cryptography-rust",
            "content_html": "<p><img src=\"./pqc-iiot-banner.jpg\" alt=\"Post-Quantum Cryptography for IIoT\"></p>\n<blockquote>\n<p>\"Quantum-safe infrastructure starts at the silicon level. We built <code class=\"language-text\">pqc-iiot</code> to be that foundation.\"</p>\n</blockquote>\n<h2 id=\"why-we-built-pqc-iiot\" style=\"position:relative;\"><a href=\"#why-we-built-pqc-iiot\" aria-label=\"why we built pqc iiot permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why We Built <code class=\"language-text\">pqc-iiot</code></h2>\n<p>The looming threat of quantum computing has made it imperative to rethink how we secure digital communication — especially in <strong>Industrial IoT (IIoT)</strong> systems, where devices are often deployed for decades with limited ability to patch or upgrade.</p>\n<p><strong><code class=\"language-text\">pqc-iiot</code></strong> is a modular, <code class=\"language-text\">no_std</code>-compatible Rust crate designed from scratch to bring <strong>post-quantum cryptographic primitives</strong> to resource-constrained devices.</p>\n<p>Our goal was to build a <strong>portable, memory-efficient, and secure-by-design library</strong> that supports <strong>Kyber</strong> (KEM), <strong>Falcon</strong> (signatures), and other NIST PQC algorithms with real-world applicability in constrained IIoT environments.</p>\n<h2 id=\"design-requirements\" style=\"position:relative;\"><a href=\"#design-requirements\" aria-label=\"design requirements permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design Requirements</h2>\n<p>We started with some hard non-negotiables:</p>\n<ul>\n<li><strong>Post-Quantum primitives only</strong> — no hybrid fallback to RSA/ECC</li>\n<li><strong>Must compile with <code class=\"language-text\">#![no_std]</code></strong> and run on microcontrollers</li>\n<li><strong>Zero-allocation</strong> with strict memory control via <code class=\"language-text\">heapless</code></li>\n<li><strong>Constant-time operations</strong> to resist side-channel attacks</li>\n<li><strong>High-level API</strong> for easy adoption across MQTT, CoAP, LoRaWAN, etc.</li>\n</ul>\n<h2 id=\"architecture-overview\" style=\"position:relative;\"><a href=\"#architecture-overview\" aria-label=\"architecture overview permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Architecture Overview</h2>\n<p>The crate follows a modular layout:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">src/\n├── kem.rs         # Kyber / Saber (KEM)\n├── sign.rs        # Falcon / Dilithium (signatures)\n├── profile.rs     # CryptoProfile abstraction layer\n├── utils.rs       # RNG, hashing, key encoding\n├── lib.rs         # Public API</code></pre></div>\n<h3 id=\"supported-algorithms\" style=\"position:relative;\"><a href=\"#supported-algorithms\" aria-label=\"supported algorithms permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Supported Algorithms</h3>\n<p>We currently support:</p>\n<ul>\n<li><strong>Kyber512, Kyber768, Kyber1024</strong></li>\n<li><strong>Falcon-512, Falcon-1024</strong></li>\n<li><strong>Dilithium (experimental)</strong></li>\n<li><strong>Saber (KEM alternative)</strong></li>\n<li><strong>BIKE (experimental)</strong></li>\n</ul>\n<p>These can be selected via Cargo features, or grouped into <strong>profiles</strong>.</p>\n<h2 id=\"crypto-profiles\" style=\"position:relative;\"><a href=\"#crypto-profiles\" aria-label=\"crypto profiles permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Crypto Profiles</h2>\n<p>To simplify configuration and usage in constrained environments, we introduced <code class=\"language-text\">CryptoProfile</code>, a high-level abstraction for pairing a KEM with a digital signature scheme.</p>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">let</span> profile <span class=\"token operator\">=</span> <span class=\"token class-name\">CryptoProfile</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">KyberFalcon</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">let</span> <span class=\"token punctuation\">(</span>pk<span class=\"token punctuation\">,</span> sk<span class=\"token punctuation\">)</span> <span class=\"token operator\">=</span> profile<span class=\"token punctuation\">.</span><span class=\"token function\">generate_keypair</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">let</span> ciphertext <span class=\"token operator\">=</span> profile<span class=\"token punctuation\">.</span><span class=\"token function\">encapsulate</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>pk<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">let</span> signature <span class=\"token operator\">=</span> profile<span class=\"token punctuation\">.</span><span class=\"token function\">sign</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&amp;</span>sk<span class=\"token punctuation\">,</span> message<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>This allows developers to pick from balanced, high-security, or low-power profiles depending on hardware capabilities.</p>\n<h2 id=\"integration-with-iiot-protocols\" style=\"position:relative;\"><a href=\"#integration-with-iiot-protocols\" aria-label=\"integration with iiot protocols permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Integration with IIoT Protocols</h2>\n<p>The library was built to be integrated into:</p>\n<ul>\n<li><strong>MQTT stacks</strong> (e.g. rumqttc)</li>\n<li><strong>CoAP frameworks</strong> (<code class=\"language-text\">coap-lite</code>)</li>\n<li><strong>Custom serial protocols</strong> for edge gateways</li>\n</ul>\n<blockquote>\n<p>Secure payloads are encapsulated using Kyber and authenticated with Falcon, enabling end-to-end post-quantum secure messaging.</p>\n</blockquote>\n<h2 id=\"performance--footprint\" style=\"position:relative;\"><a href=\"#performance--footprint\" aria-label=\"performance  footprint permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Performance &#x26; Footprint</h2>\n<table>\n<thead>\n<tr>\n<th>Operation</th>\n<th>Kyber512</th>\n<th>Falcon512</th>\n<th>Platform</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Keygen</td>\n<td>~3.1ms</td>\n<td>~9.4ms</td>\n<td>STM32F4 (168MHz)</td>\n</tr>\n<tr>\n<td>Encaps/Decaps</td>\n<td>~2.8ms</td>\n<td>N/A</td>\n<td></td>\n</tr>\n<tr>\n<td>Sign/Verify</td>\n<td>N/A</td>\n<td>~8.9ms</td>\n<td></td>\n</tr>\n<tr>\n<td>RAM (peak)</td>\n<td>&#x3C;32KB</td>\n<td>&#x3C;45KB</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<ul>\n<li>All timings are constant-time implementations</li>\n<li>Measured with <code class=\"language-text\">cargo-embed</code> on <code class=\"language-text\">thumbv7em-none-eabihf</code></li>\n</ul>\n<h2 id=\"security-considerations\" style=\"position:relative;\"><a href=\"#security-considerations\" aria-label=\"security considerations permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security Considerations</h2>\n<ul>\n<li>RNG is based on <code class=\"language-text\">rand_core</code> and configurable to use hardware TRNG</li>\n<li>Wiped secrets using <code class=\"language-text\">zeroize</code> traits</li>\n<li>Internal operations audited to prevent timing leaks</li>\n</ul>\n<h2 id=\"development-process\" style=\"position:relative;\"><a href=\"#development-process\" aria-label=\"development process permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Development Process</h2>\n<ol>\n<li><strong>Phase 1</strong> — Research &#x26; algorithm selection</li>\n<li><strong>Phase 2</strong> — <code class=\"language-text\">no_std</code> crate skeleton, Kyber+Falcon working</li>\n<li><strong>Phase 3</strong> — MQTT/CoAP integration, secure messaging</li>\n<li><strong>Phase 4</strong> — Benchmarks, fuzz testing, memory profiling</li>\n<li><strong>Phase 5</strong> — Expansion with Saber, Dilithium, BIKE</li>\n<li><strong>Phase 6</strong> — Introduction of <code class=\"language-text\">CryptoProfile</code> abstraction</li>\n</ol>\n<h2 id=\"limitations\" style=\"position:relative;\"><a href=\"#limitations\" aria-label=\"limitations permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Limitations</h2>\n<ul>\n<li><strong>No TLS integration yet</strong> — planned for Phase 7 (rustls hybrid support)</li>\n<li><strong>Only deterministic keygen</strong> — no on-device entropy enhancement</li>\n<li><strong>Experimental algorithms not production-hardened</strong></li>\n</ul>\n<h2 id=\"future-directions\" style=\"position:relative;\"><a href=\"#future-directions\" aria-label=\"future directions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Future Directions</h2>\n<ul>\n<li>WASM demo + WebSerial secure handshake</li>\n<li>Integration with Zephyr RTOS and RIOT</li>\n<li>Dynamic crypto profile loading via config</li>\n<li>NIST-compliant key formatting (SP 800-56C)</li>\n<li>PQ-TLS bindings for constrained TLS over MQTT</li>\n</ul>\n<h2 id=\"try-it-now\" style=\"position:relative;\"><a href=\"#try-it-now\" aria-label=\"try it now permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Try It Now</h2>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">cargo</span> <span class=\"token function\">add</span> pqc-iiot <span class=\"token parameter variable\">--git</span> https://github.com/doomhammerhell/pqc-iiot</code></pre></div>\n<h2 id=\"final-thoughts\" style=\"position:relative;\"><a href=\"#final-thoughts\" aria-label=\"final thoughts permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Final Thoughts</h2>\n<blockquote>\n<p>We don’t just need stronger encryption — we need encryption that survives the next 30 years.</p>\n</blockquote>\n<p><code class=\"language-text\">pqc-iiot</code> is an evolving foundation for secure-by-default IIoT systems. Whether you’re securing sensors, edge gateways, or autonomous machines, this crate is designed to give you the cryptographic edge in a quantum future.</p>\n<hr>\n<p>💬 Questions? PRs and issues welcome at <a href=\"https://github.com/doomhammerhell/pqc-iiot\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GitHub</a>.</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">\n---</code></pre></div>",
            "url": "https://mayckongiovani.xyz/pensieve/pqc-iiot-post-quantum-cryptography-rust",
            "title": "Post-Quantum Cryptography for Industrial IoT with Rust",
            "summary": "A deep technical dive into the pqc-iiot Rust crate for secure, no_std, post-quantum cryptography in embedded and IIoT environments.",
            "date_modified": "2025-04-28T00:00:00.000Z",
            "tags": [
                "post-quantum",
                "rust",
                "iiot",
                "cryptography",
                "no_std",
                "embedded"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-04-pqc-for-blockchain-signatures-wallet-ux-size-and-verificatio",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>PQC for Blockchain Signatures: Wallet UX, Size, and Verification Cost</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Define success metrics beyond “enabled”: cohorts, failures, and evidence.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming performance impacts will be negligible.</li>\n<li>Relying on ‘automatic’ negotiation without downgrade resistance.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>PQ readiness is a systems program: crypto, networking, ops, and UX must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--1\">(<a href=\"#bib-rfc8446\">1</a>)</span> — A useful reference for handshake structure and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-04-pqc-for-blockchain-signatures-wallet-ux-size-and-verificatio",
            "title": "PQC for Blockchain Signatures: Wallet UX, Size, and Verification Cost",
            "summary": "Adversarial-first deep dive (April 2025): PQC for Blockchain Signatures: Wallet UX, Size, and Verification Cost.",
            "date_modified": "2025-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-03-quantum-safe-secure-boot-firmware-roots-and-pq-signatures",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Quantum-Safe Secure Boot: Firmware Roots and PQ Signatures</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Define success metrics beyond “enabled”: cohorts, failures, and evidence.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Migration risk is operational: inventory, rollout, rollback, and monitoring.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating PQ migration as a single deployment event.</li>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Risk is a function of exposure and lifetime:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo>≈</mo><mrow><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">x</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">e</mi></mrow><mo>×</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{risk} \\approx \\mathrm{exposure} \\times \\mathrm{lifetime} \\times \\mathrm{adversary\\_capability}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">risk</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">exposure</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.7778em;vertical-align:-0.0833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">lifetime</span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">adversary_capability</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  inventory<span class=\"token text string\">[\"Inventory\"]</span> <span class=\"token arrow operator\">--></span> prioritize<span class=\"token text string\">[\"Prioritize\"]</span>\n  prioritize <span class=\"token arrow operator\">--></span> hybrid<span class=\"token text string\">[\"Hybrid Deploy\"]</span>\n  hybrid <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor\"]</span>\n  monitor <span class=\"token arrow operator\">--></span> cutover<span class=\"token text string\">[\"Cutover\"]</span>\n  cutover <span class=\"token arrow operator\">--></span> deprecate<span class=\"token text string\">[\"Deprecate Old\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Design hybrid modes with explicit binding and observable outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — The standardization baseline for PQC readiness programs.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-03-quantum-safe-secure-boot-firmware-roots-and-pq-signatures",
            "title": "Quantum-Safe Secure Boot: Firmware Roots and PQ Signatures",
            "summary": "Engineering notebook entry (March 2025): Quantum-Safe Secure Boot: Firmware Roots and PQ Signatures.",
            "date_modified": "2025-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-02-hybrid-key-management-rotations-across-algorithm-families",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Hybrid Key Management: Rotations Across Algorithm Families</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Measure cost shifts (CPU/bandwidth) and adapt DoS defenses accordingly.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you manage mixed deployments across regions and vendors?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n<li>Adversaries record traffic today (HNDL) and attack later.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Switching algorithms without inventorying where secrets are used.</li>\n<li>Treating PQ migration as a single deployment event.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat ops as part of the protocol: monitoring, rollback, and incident response.</p>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  threat<span class=\"token text string\">[\"Threat Model (quantum + classical)\"]</span> <span class=\"token arrow operator\">--></span> design<span class=\"token text string\">[\"Protocol Design\"]</span>\n  design <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (no_std where needed)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> verify<span class=\"token text string\">[\"Verification (tests + formal)\"]</span>\n  verify <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Operationalization (rotation + monitoring)\"]</span>\n  ops <span class=\"token arrow operator\">--></span> threat</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Design hybrid modes with explicit binding and observable outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--2\">(<a href=\"#bib-rfc8446\">2</a>)</span> — A useful reference for handshake structure and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-02-hybrid-key-management-rotations-across-algorithm-families",
            "title": "Hybrid Key Management: Rotations Across Algorithm Families",
            "summary": "Spec-driven research note (February 2025): Hybrid Key Management: Rotations Across Algorithm Families.",
            "date_modified": "2025-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2025-01-quantum-threat-modeling-for-infrastructure-what-changes-what",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Quantum-Resilient Systems Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Quantum Threat Modeling for Infrastructure: What Changes, What Doesn’t</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Inventory long-lived secrets first; you can’t migrate what you can’t locate.</li>\n<li>Hybrid is an operational mode: deploy, monitor, rollback—not a paper design.</li>\n<li>Downgrade resistance must be explicit and tested under active attackers.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Long-lived devices and PKI lifecycles are the hard constraint.</li>\n<li>Hybrid protocols fail if binding is unclear or downgrade is possible.</li>\n<li>Quantum risk is uneven: some secrets must last decades, others do not.</li>\n<li>Cost changes drive new DoS surfaces; defenses must evolve.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you validate resilience (DoS, side channels, rollback, compromise)?</li>\n<li>What does rotation look like at fleet scale (devices, certs, tunnels, identities)?</li>\n<li>How do you define success metrics for PQ readiness beyond “enabled”?</li>\n<li>What secrets must remain confidential for 10–30 years (and where are they today)?</li>\n<li>Which protocols need hybrid now, and which can wait without regret?</li>\n<li>How do you stop downgrade under active adversaries?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Key and certificate lifecycles outlive application versions.</li>\n<li>Some environments require constrained implementations (no_std, embedded).</li>\n<li>Operational teams need safe playbooks; crypto changes are not one-off.</li>\n<li>Rollouts happen under partial adoption; compatibility matters.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on ‘automatic’ negotiation without downgrade resistance.</li>\n<li>Assuming performance impacts will be negligible.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be explicit and transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Inventory first. You can’t migrate what you can’t locate.</p>\n<p>Make downgrade resistance explicit and test it like a security feature.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  threat<span class=\"token text string\">[\"Threat Model (quantum + classical)\"]</span> <span class=\"token arrow operator\">--></span> design<span class=\"token text string\">[\"Protocol Design\"]</span>\n  design <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (no_std where needed)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> verify<span class=\"token text string\">[\"Verification (tests + formal)\"]</span>\n  verify <span class=\"token arrow operator\">--></span> ops<span class=\"token text string\">[\"Operationalization (rotation + monitoring)\"]</span>\n  ops <span class=\"token arrow operator\">--></span> threat</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Operationalize early: rollback and monitoring are part of the design.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// PQ migration note: \"enabled\" is not \"safe\" unless binding and downgrade resistance are explicit.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop tests</strong> across stacks and versions.</li>\n<li><strong>Downgrade simulations</strong> with active attackers.</li>\n<li><strong>Side-channel audits</strong> for constrained implementations.</li>\n<li><strong>Performance profiling</strong> under load to quantify DoS risk.</li>\n<li><strong>Rotation drills</strong>: certificates, tunnels, device identities.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an inventory of long-lived secrets and their lifetimes.</li>\n<li>Practice emergency deprecation (turn off broken algorithms quickly).</li>\n<li>Define compatibility windows and communicate them to stakeholders.</li>\n<li>Roll out hybrid with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for algorithm negotiation and failure modes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational lessons relevant to rotation and recovery at scale.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--2\">(<a href=\"#bib-rfc8446\">2</a>)</span> — A useful reference for handshake structure and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which protocol surfaces are most exposed to HNDL risk in your environment?</li>\n<li>What is your plan for third-party dependencies that can’t migrate quickly?</li>\n<li>What is your minimal ‘safe mode’ when PQ paths fail?</li>\n<li>How do you prevent configuration drift from re-enabling weak modes?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational lessons relevant to rotation and recovery at scale.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — The standardization baseline for PQC readiness programs.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — A useful reference for handshake structure and downgrade resistance patterns.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2025-01-quantum-threat-modeling-for-infrastructure-what-changes-what",
            "title": "Quantum Threat Modeling for Infrastructure: What Changes, What Doesn’t",
            "summary": "Adversarial-first deep dive (January 2025): Quantum Threat Modeling for Infrastructure: What Changes, What Doesn’t.",
            "date_modified": "2025-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "security-critical-infrastructure",
                "protocol-design",
                "cryptography"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-12-designing-for-catastrophic-failure-compartmentalization-and-",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Designing for Catastrophic Failure: Compartmentalization and Recovery</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Dependencies (DNS, routing, PKI) are shared attack surfaces—plan containment.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n<li>Relying on dashboards that vanish during the incident.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Resilience is about containment:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>damage</mtext><mo>≤</mo><munder><mo>∑</mo><mi>i</mi></munder><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>with</mtext><mspace width=\"1em\"></mspace><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mtext> bounded by design</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{damage} \\le \\sum_i \\text{blast\\_radius}(i)\\quad\\text{with}\\quad \\text{blast\\_radius}(i)\\ \\text{bounded by design}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">damage</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.3277em;vertical-align:-1.2777em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8723em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.2777em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">with</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">bounded by design</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Evidence checklist:\n- Immutable logs (append-only)\n- Signed audit events\n- Time sync monitoring\n- Dependency health snapshots\n- Config change history</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-12-designing-for-catastrophic-failure-compartmentalization-and-",
            "title": "Designing for Catastrophic Failure: Compartmentalization and Recovery",
            "summary": "Spec-driven research note (December 2024): Designing for Catastrophic Failure: Compartmentalization and Recovery.",
            "date_modified": "2024-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-11-zkp-systems-engineering-provers-verifiers-and-operational-co",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>ZKP Systems Engineering: Provers, Verifiers, and Operational Cost</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating degraded modes as “we’ll decide later.”</li>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-11-zkp-systems-engineering-provers-verifiers-and-operational-co",
            "title": "ZKP Systems Engineering: Provers, Verifiers, and Operational Cost",
            "summary": "Threat-model-first analysis (November 2024): ZKP Systems Engineering: Provers, Verifiers, and Operational Cost.",
            "date_modified": "2024-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-10-formal-verification-of-crypto-protocols-models-gaps-and-pain",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Formal Verification of Crypto Protocols: Models, Gaps, and Pain</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Degraded modes without explicit policy become accidental vulnerabilities.</li>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n<li>Assuming WAF/rate limits are sufficient without architecture changes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Degraded modes are design artifacts. Write them down and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-10-formal-verification-of-crypto-protocols-models-gaps-and-pain",
            "title": "Formal Verification of Crypto Protocols: Models, Gaps, and Pain",
            "summary": "Spec-driven research note (October 2024): Formal Verification of Crypto Protocols: Models, Gaps, and Pain.",
            "date_modified": "2024-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-09-secure-enclaves-in-distributed-systems-remote-attestation-an",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secure Enclaves in Distributed Systems: Remote Attestation and Trust</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on dashboards that vanish during the incident.</li>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep evidence pipelines alive: you can’t respond blind.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-09-secure-enclaves-in-distributed-systems-remote-attestation-an",
            "title": "Secure Enclaves in Distributed Systems: Remote Attestation and Trust",
            "summary": "Spec-driven research note (September 2024): Secure Enclaves in Distributed Systems: Remote Attestation and Trust.",
            "date_modified": "2024-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-08-metadata-and-privacy-the-hard-part-isn-t-encryption",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Metadata and Privacy: The Hard Part Isn’t Encryption</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Degraded modes without explicit policy become accidental vulnerabilities.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on dashboards that vanish during the incident.</li>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Resilience is about containment:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>damage</mtext><mo>≤</mo><munder><mo>∑</mo><mi>i</mi></munder><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>with</mtext><mspace width=\"1em\"></mspace><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mtext> bounded by design</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{damage} \\le \\sum_i \\text{blast\\_radius}(i)\\quad\\text{with}\\quad \\text{blast\\_radius}(i)\\ \\text{bounded by design}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">damage</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.3277em;vertical-align:-1.2777em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8723em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.2777em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">with</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">bounded by design</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep evidence pipelines alive: you can’t respond blind.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Evidence checklist:\n- Immutable logs (append-only)\n- Signed audit events\n- Time sync monitoring\n- Dependency health snapshots\n- Config change history</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-08-metadata-and-privacy-the-hard-part-isn-t-encryption",
            "title": "Metadata and Privacy: The Hard Part Isn’t Encryption",
            "summary": "Threat-model-first analysis (August 2024): Metadata and Privacy: The Hard Part Isn’t Encryption.",
            "date_modified": "2024-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-07-byzantine-fault-injection-testing-protocols-like-an-attacker",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Byzantine Fault Injection: Testing Protocols Like an Attacker</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n<li>Relying on dashboards that vanish during the incident.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-07-byzantine-fault-injection-testing-protocols-like-an-attacker",
            "title": "Byzantine Fault Injection: Testing Protocols Like an Attacker",
            "summary": "Adversarial-first deep dive (July 2024): Byzantine Fault Injection: Testing Protocols Like an Attacker.",
            "date_modified": "2024-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-06-consensus-under-attack-adaptive-adversaries-and-network-cont",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Consensus Under Attack: Adaptive Adversaries and Network Control</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Dependencies (DNS, routing, PKI) are shared attack surfaces—plan containment.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Degraded modes without explicit policy become accidental vulnerabilities.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n<li>Relying on dashboards that vanish during the incident.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Resilience is about containment:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>damage</mtext><mo>≤</mo><munder><mo>∑</mo><mi>i</mi></munder><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>with</mtext><mspace width=\"1em\"></mspace><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mtext> bounded by design</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{damage} \\le \\sum_i \\text{blast\\_radius}(i)\\quad\\text{with}\\quad \\text{blast\\_radius}(i)\\ \\text{bounded by design}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">damage</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.3277em;vertical-align:-1.2777em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8723em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.2777em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">with</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">bounded by design</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep evidence pipelines alive: you can’t respond blind.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-06-consensus-under-attack-adaptive-adversaries-and-network-cont",
            "title": "Consensus Under Attack: Adaptive Adversaries and Network Control",
            "summary": "Spec-driven research note (June 2024): Consensus Under Attack: Adaptive Adversaries and Network Control.",
            "date_modified": "2024-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-05-time-based-attacks-ntp-manipulation-expiration-and-replay",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Time-Based Attacks: NTP Manipulation, Expiration, and Replay</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Degraded modes without explicit policy become accidental vulnerabilities.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on dashboards that vanish during the incident.</li>\n<li>Treating degraded modes as “we’ll decide later.”</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Resilience is about containment:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>damage</mtext><mo>≤</mo><munder><mo>∑</mo><mi>i</mi></munder><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>with</mtext><mspace width=\"1em\"></mspace><mtext>blast_radius</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mtext> bounded by design</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{damage} \\le \\sum_i \\text{blast\\_radius}(i)\\quad\\text{with}\\quad \\text{blast\\_radius}(i)\\ \\text{bounded by design}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord text\"><span class=\"mord\">damage</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:2.3277em;vertical-align:-1.2777em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8723em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">i</span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.2777em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">with</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">blast_radius</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">bounded by design</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Evidence checklist:\n- Immutable logs (append-only)\n- Signed audit events\n- Time sync monitoring\n- Dependency health snapshots\n- Config change history</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-05-time-based-attacks-ntp-manipulation-expiration-and-replay",
            "title": "Time-Based Attacks: NTP Manipulation, Expiration, and Replay",
            "summary": "Adversarial-first deep dive (May 2024): Time-Based Attacks: NTP Manipulation, Expiration, and Replay.",
            "date_modified": "2024-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-04-sandbox-escapes-isolation-boundaries-as-a-design-input",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Sandbox Escapes: Isolation Boundaries as a Design Input</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Dependencies (DNS, routing, PKI) are shared attack surfaces—plan containment.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Operators are human and will make mistakes under pressure.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming WAF/rate limits are sufficient without architecture changes.</li>\n<li>Relying on dashboards that vanish during the incident.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep evidence pipelines alive: you can’t respond blind.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Evidence checklist:\n- Immutable logs (append-only)\n- Signed audit events\n- Time sync monitoring\n- Dependency health snapshots\n- Config change history</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-04-sandbox-escapes-isolation-boundaries-as-a-design-input",
            "title": "Sandbox Escapes: Isolation Boundaries as a Design Input",
            "summary": "Spec-driven research note (April 2024): Sandbox Escapes: Isolation Boundaries as a Design Input.",
            "date_modified": "2024-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-03-supply-chain-attacks-dependency-poisoning-and-maintainer-com",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Supply Chain Attacks: Dependency Poisoning and Maintainer Compromise</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Logs are only useful if they remain trustworthy under compromise.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n<li>Treating degraded modes as “we’ll decide later.”</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-03-supply-chain-attacks-dependency-poisoning-and-maintainer-com",
            "title": "Supply Chain Attacks: Dependency Poisoning and Maintainer Compromise",
            "summary": "Adversarial-first deep dive (March 2024): Supply Chain Attacks: Dependency Poisoning and Maintainer Compromise.",
            "date_modified": "2024-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-02-ddos-at-scale-adaptive-defense-and-cost-asymmetry",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>DDoS at Scale: Adaptive Defense and Cost Asymmetry</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Evidence pipelines (audit/config history) are part of incident response correctness.</li>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Incident response is a protocol: practice it, automate it, validate it.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>Where is the attacker’s leverage (routing, DNS, dependency, identity, time)?</li>\n<li>How do you make abuse expensive (proof-of-work, quotas, pricing, friction)?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Operators are human and will make mistakes under pressure.</li>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming WAF/rate limits are sufficient without architecture changes.</li>\n<li>Assuming perfect attribution (you rarely know who is attacking in real time).</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Engineer friction where attackers pay but legitimate users don’t (asymmetric controls).</p>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  edge<span class=\"token text string\">[\"Edge (rate limits + WAF)\"]</span> <span class=\"token arrow operator\">--></span> core<span class=\"token text string\">[\"Core Services\"]</span>\n  core <span class=\"token arrow operator\">--></span> data<span class=\"token text string\">[\"Data Plane\"]</span>\n  data <span class=\"token arrow operator\">--></span> control<span class=\"token text string\">[\"Control Plane\"]</span>\n  control <span class=\"token arrow operator\">--></span> edge\n  siem<span class=\"token text string\">[\"Detection/Response\"]</span> <span class=\"token arrow operator\">--></span> core\n  siem <span class=\"token arrow operator\">--></span> edge</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer containment over heroics: isolate blast radius, keep core correct.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Evidence checklist:\n- Immutable logs (append-only)\n- Signed audit events\n- Time sync monitoring\n- Dependency health snapshots\n- Config change history</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-02-ddos-at-scale-adaptive-defense-and-cost-asymmetry",
            "title": "DDoS at Scale: Adaptive Defense and Cost Asymmetry",
            "summary": "Spec-driven research note (February 2024): DDoS at Scale: Adaptive Defense and Cost Asymmetry.",
            "date_modified": "2024-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2024-01-bgp-and-routing-attacks-engineering-for-the-internet-we-have",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Adversarial Infrastructure &#x26; Global Systems</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>BGP and Routing Attacks: Engineering for the Internet We Have</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Protect observability: you can’t respond blind, and telemetry can be attacked.</li>\n<li>Degraded modes are security decisions; write them down and test them.</li>\n<li>Engineer cost asymmetry: defense must be cheaper than attack per unit of damage prevented.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Global dependencies (DNS, routing, PKI) are shared attack surfaces.</li>\n<li>Attackers exploit cost asymmetry: make abuse cheap and defense expensive.</li>\n<li>Degraded modes without explicit policy become accidental vulnerabilities.</li>\n<li>Privacy failures often come from metadata, not plaintext.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your degraded-mode behavior (and is it safe)?</li>\n<li>What is the minimum viable recovery path after a catastrophic event?</li>\n<li>Which controls fail first under load: auth, rate limits, storage, or observability?</li>\n<li>Which logs are trustworthy under compromise (append-only, signed, isolated)?</li>\n<li>How do you detect attacks that look like “normal traffic spikes”?</li>\n<li>How do you prevent dependency failures from becoming integrity failures?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Observability pipelines can be attacked (cardinality explosions, log injection).</li>\n<li>Traffic spikes can be malicious or accidental; you must handle both.</li>\n<li>Attackers can manipulate routing and DNS indirectly (upstream failures, BGP issues).</li>\n<li>Some dependencies will fail open or fail closed unexpectedly.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating degraded modes as “we’ll decide later.”</li>\n<li>Relying on dashboards that vanish during the incident.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Defense is about cost asymmetry. If the attacker spends <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>1</mn></mrow><annotation encoding=\"application/x-tex\">1</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1</span></span></span></span></span> and you spend <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mn>100</mn></mrow><annotation encoding=\"application/x-tex\">100</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">100</span></span></span></span></span>, you lose.</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>defense</mtext></msub><mo>≪</mo><msub><mrow><mi mathvariant=\"normal\">C</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mtext>attack</mtext></msub><mtext> (per unit of damage prevented)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Cost}_\\text{defense} \\ll \\mathrm{Cost}_\\text{attack}\\ \\text{(per unit of damage prevented)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">defense</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≪</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Cost</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">attack</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">(per unit of damage prevented)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat observability as a dependency: protect it from overload and manipulation.</p>\n<p>Define which operations fail closed vs fail open. Do it before an incident.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  attack<span class=\"token text string\">[\"Attack\"]</span> <span class=\"token arrow operator\">--></span> detect<span class=\"token text string\">[\"Detect\"]</span>\n  detect <span class=\"token arrow operator\">--></span> contain<span class=\"token text string\">[\"Contain\"]</span>\n  contain <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recover\"]</span>\n  recover <span class=\"token arrow operator\">--></span> learn<span class=\"token text string\">[\"Learn/Regress\"]</span>\n  learn <span class=\"token arrow operator\">--></span> detect</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep evidence pipelines alive: you can’t respond blind.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Degraded-mode table (example):\nOperation | Normal | Under attack | Rationale\nAuth      | full   | strict       | prevent abuse\nReads     | full   | cached/limited| protect core\nWrites    | full   | queued/limited| preserve integrity\nAdmin     | full   | JIT + MFA     | reduce blast radius</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Observability stress</strong>: cardinality explosions and sampling under attack.</li>\n<li><strong>Incident replay</strong>: reconstruct timeline from evidence pipelines.</li>\n<li><strong>Policy tests</strong>: fail closed/open behaviors are unit-tested.</li>\n<li><strong>Game days</strong>: simulate DDoS, dependency failure, and credential abuse.</li>\n<li><strong>Dependency chaos</strong>: DNS issues, cert failures, upstream outages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep recovery paths simple: restore from known-good, rotate secrets, reissue certs.</li>\n<li>Protect the edge and the evidence: rate limits + SIEM + log integrity.</li>\n<li>Instrument cost: which defenses become expensive and when.</li>\n<li>Make emergency controls quick: feature flags, circuit breakers, safe defaults.</li>\n<li>Document and rehearse degraded-mode policy with on-call rotations.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Operational failures and recovery in real-world PKI.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you keep control-plane access during widespread incidents?</li>\n<li>What is your ‘safe mode’ when dependencies fail?</li>\n<li>Which operation, if abused, causes irreversible damage?</li>\n<li>Where do you pay cost asymmetry today—and can you flip it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cloudflare Outage (July 2, 2019) Postmortem</a> — A concrete example of global failure, containment, and recovery lessons.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Operational failures and recovery in real-world PKI.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc4271\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 4271: BGP-4</a> — Routing is part of your threat model whether you like it or not.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc6480\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 6480: An Infrastructure to Support Secure Internet Routing</a> — RPKI basics and why routing security is hard operationally.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2024-01-bgp-and-routing-attacks-engineering-for-the-internet-we-have",
            "title": "BGP and Routing Attacks: Engineering for the Internet We Have",
            "summary": "Engineering notebook entry (January 2024): BGP and Routing Attacks: Engineering for the Internet We Have.",
            "date_modified": "2024-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "security",
                "distributed-infrastructure",
                "threat-modeling",
                "resilience"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-12-compliance-standards-translating-nist-to-engineering-action",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Compliance &#x26; Standards: Translating NIST to Engineering Action</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Constant-time requirements don’t disappear; they become harder under bigger primitives.</li>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Constant-time constraints are harder under large primitives.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating migration as a single flag flip.</li>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Interop tests are the migration plan; everything else is a hypothesis.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-12-compliance-standards-translating-nist-to-engineering-action",
            "title": "Compliance & Standards: Translating NIST to Engineering Action",
            "summary": "Adversarial-first deep dive (December 2023): Compliance & Standards: Translating NIST to Engineering Action.",
            "date_modified": "2023-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-11-migration-risk-management-inventory-prioritization-and-cutov",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Migration Risk Management: Inventory, Prioritization, and Cutover</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Migration will be mixed-version for years; plan for it explicitly.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating migration as a single flag flip.</li>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Interop tests are the migration plan; everything else is a hypothesis.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--1\">(<a href=\"#bib-nistpqc\">1</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-11-migration-risk-management-inventory-prioritization-and-cutov",
            "title": "Migration Risk Management: Inventory, Prioritization, and Cutover",
            "summary": "Correctness-focused deep dive (November 2023): Migration Risk Management: Inventory, Prioritization, and Cutover.",
            "date_modified": "2023-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-10-side-channels-in-pqc-implementations-where-theory-meets-cach",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Side Channels in PQC Implementations: Where Theory Meets Cache</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n<li>Ignoring DoS implications of large primitives.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  negotiate<span class=\"token text string\">[\"Negotiate Algorithms\"]</span> <span class=\"token arrow operator\">--></span> bind<span class=\"token text string\">[\"Bind Transcript\"]</span>\n  bind <span class=\"token arrow operator\">--></span> kdf<span class=\"token text string\">[\"KDF (hybrid)\"]</span>\n  kdf <span class=\"token arrow operator\">--></span> keys<span class=\"token text string\">[\"Traffic Keys\"]</span>\n  keys <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor + Rollback\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-10-side-channels-in-pqc-implementations-where-theory-meets-cach",
            "title": "Side Channels in PQC Implementations: Where Theory Meets Cache",
            "summary": "Correctness-focused deep dive (October 2023): Side Channels in PQC Implementations: Where Theory Meets Cache.",
            "date_modified": "2023-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-09-benchmarking-pqc-what-to-measure-and-what-not-to",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Benchmarking PQC: What to Measure (and What Not To)</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Migration will be mixed-version for years; plan for it explicitly.</li>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating migration as a single flag flip.</li>\n<li>Ignoring DoS implications of large primitives.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-09-benchmarking-pqc-what-to-measure-and-what-not-to",
            "title": "Benchmarking PQC: What to Measure (and What Not To)",
            "summary": "Threat-model-first analysis (September 2023): Benchmarking PQC: What to Measure (and What Not To).",
            "date_modified": "2023-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-08-crypto-agility-tooling-feature-flags-policy-and-rollback",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Crypto Agility Tooling: Feature Flags, Policy, and Rollback</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Constant-time requirements don’t disappear; they become harder under bigger primitives.</li>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n<li>Ignoring DoS implications of large primitives.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  negotiate<span class=\"token text string\">[\"Negotiate Algorithms\"]</span> <span class=\"token arrow operator\">--></span> bind<span class=\"token text string\">[\"Bind Transcript\"]</span>\n  bind <span class=\"token arrow operator\">--></span> kdf<span class=\"token text string\">[\"KDF (hybrid)\"]</span>\n  kdf <span class=\"token arrow operator\">--></span> keys<span class=\"token text string\">[\"Traffic Keys\"]</span>\n  keys <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor + Rollback\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--2\">(<a href=\"#bib-rfc5869\">2</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-08-crypto-agility-tooling-feature-flags-policy-and-rollback",
            "title": "Crypto Agility Tooling: Feature Flags, Policy, and Rollback",
            "summary": "Design memo (August 2023): Crypto Agility Tooling: Feature Flags, Policy, and Rollback.",
            "date_modified": "2023-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-07-pqc-for-iot-memory-cpu-and-timing-side-channels",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>PQC for IoT: Memory, CPU, and Timing Side Channels</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Ignoring DoS implications of large primitives.</li>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  negotiate<span class=\"token text string\">[\"Negotiate Algorithms\"]</span> <span class=\"token arrow operator\">--></span> bind<span class=\"token text string\">[\"Bind Transcript\"]</span>\n  bind <span class=\"token arrow operator\">--></span> kdf<span class=\"token text string\">[\"KDF (hybrid)\"]</span>\n  kdf <span class=\"token arrow operator\">--></span> keys<span class=\"token text string\">[\"Traffic Keys\"]</span>\n  keys <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor + Rollback\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Interop tests are the migration plan; everything else is a hypothesis.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-07-pqc-for-iot-memory-cpu-and-timing-side-channels",
            "title": "PQC for IoT: Memory, CPU, and Timing Side Channels",
            "summary": "Engineering notebook entry (July 2023): PQC for IoT: Memory, CPU, and Timing Side Channels.",
            "date_modified": "2023-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-06-pqc-in-vpn-ipsec-ikev2-revisited-under-pq-constraints",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>PQC in VPN/IPsec: IKEv2 Revisited Under PQ Constraints</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Ignoring DoS implications of large primitives.</li>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  negotiate<span class=\"token text string\">[\"Negotiate Algorithms\"]</span> <span class=\"token arrow operator\">--></span> bind<span class=\"token text string\">[\"Bind Transcript\"]</span>\n  bind <span class=\"token arrow operator\">--></span> kdf<span class=\"token text string\">[\"KDF (hybrid)\"]</span>\n  kdf <span class=\"token arrow operator\">--></span> keys<span class=\"token text string\">[\"Traffic Keys\"]</span>\n  keys <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor + Rollback\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--1\">(<a href=\"#bib-nistpqc\">1</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--2\">(<a href=\"#bib-rfc5869\">2</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-06-pqc-in-vpn-ipsec-ikev2-revisited-under-pq-constraints",
            "title": "PQC in VPN/IPsec: IKEv2 Revisited Under PQ Constraints",
            "summary": "Threat-model-first analysis (June 2023): PQC in VPN/IPsec: IKEv2 Revisited Under PQ Constraints.",
            "date_modified": "2023-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-05-pqc-in-tls-negotiation-downgrade-and-interop",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>PQC in TLS: Negotiation, Downgrade, and Interop</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Migration will be mixed-version for years; plan for it explicitly.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Hybrid handshake checklist:\n- Explicit negotiation (no silent downgrade)\n- Transcript-bound KDF\n- DoS protections (rate limits, cookies, puzzles)\n- Constant-time operations\n- Telemetry: which mode, which failures, which clients</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-05-pqc-in-tls-negotiation-downgrade-and-interop",
            "title": "PQC in TLS: Negotiation, Downgrade, and Interop",
            "summary": "Threat-model-first analysis (May 2023): PQC in TLS: Negotiation, Downgrade, and Interop.",
            "date_modified": "2023-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-04-hybrid-key-exchange-binding-classical-and-pq-secrets-correct",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Hybrid Key Exchange: Binding Classical and PQ Secrets Correctly</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Constant-time requirements don’t disappear; they become harder under bigger primitives.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Constant-time constraints are harder under large primitives.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n<li>Treating migration as a single flag flip.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Interop tests are the migration plan; everything else is a hypothesis.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-04-hybrid-key-exchange-binding-classical-and-pq-secrets-correct",
            "title": "Hybrid Key Exchange: Binding Classical and PQ Secrets Correctly",
            "summary": "Design memo (April 2023): Hybrid Key Exchange: Binding Classical and PQ Secrets Correctly.",
            "date_modified": "2023-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-03-signatures-in-practice-dilithium-falcon-and-deployment-const",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Signatures in Practice: Dilithium/Falcon and Deployment Constraints</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Migration will be mixed-version for years; plan for it explicitly.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>How do you rotate algorithms safely (crypto agility without chaos)?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Vendors vary: implementations and defaults differ.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  negotiate<span class=\"token text string\">[\"Negotiate Algorithms\"]</span> <span class=\"token arrow operator\">--></span> bind<span class=\"token text string\">[\"Bind Transcript\"]</span>\n  bind <span class=\"token arrow operator\">--></span> kdf<span class=\"token text string\">[\"KDF (hybrid)\"]</span>\n  kdf <span class=\"token arrow operator\">--></span> keys<span class=\"token text string\">[\"Traffic Keys\"]</span>\n  keys <span class=\"token arrow operator\">--></span> monitor<span class=\"token text string\">[\"Monitor + Rollback\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Interop tests are the migration plan; everything else is a hypothesis.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--1\">(<a href=\"#bib-nistpqc\">1</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-03-signatures-in-practice-dilithium-falcon-and-deployment-const",
            "title": "Signatures in Practice: Dilithium/Falcon and Deployment Constraints",
            "summary": "Design memo (March 2023): Signatures in Practice: Dilithium/Falcon and Deployment Constraints.",
            "date_modified": "2023-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-02-kems-in-practice-kyber-handshakes-and-failure-surfaces",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>KEMs in Practice: Kyber Handshakes and Failure Surfaces</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Constant-time requirements don’t disappear; they become harder under bigger primitives.</li>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>Interop is the migration plan—test matrices are more important than whitepapers.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What are the new DoS surfaces (bigger keys, more CPU, more bandwidth)?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n<li>Active attacker can force retries, downgrades, and expensive handshakes.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on silent fallback to weaker modes during interop failures.</li>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Hybrid composition should be transcript-bound:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>=</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>classical</mtext></msub><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mtext>pqc</mtext></msub><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{ss} = \\mathrm{HKDF}(\\mathrm{ss}_\\text{classical}\\ \\Vert\\ \\mathrm{ss}_\\text{pqc},\\ \\text{info}=\\mathrm{transcript}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.4306em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0361em;vertical-align:-0.2861em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">classical</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">pqc</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2861em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">transcript</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<p>Binding is the whole game: make the transcript an input to the KDF.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>PQC migration is a systems program: protocol, performance, ops, and UX must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Hybrid binding sketch (pseudocode):</span>\n<span class=\"token comment\">// ss = HKDF(ss_classical || ss_pqc, info=transcript_hash)</span>\n<span class=\"token comment\">// Then derive traffic keys from ss.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-02-kems-in-practice-kyber-handshakes-and-failure-surfaces",
            "title": "KEMs in Practice: Kyber Handshakes and Failure Surfaces",
            "summary": "Adversarial-first deep dive (February 2023): KEMs in Practice: Kyber Handshakes and Failure Surfaces.",
            "date_modified": "2023-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2023-01-pqc-threat-models-harvest-now-decrypt-later-in-real-systems",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Post-Quantum Cryptography &#x26; Migration</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>PQC Threat Models: 'Harvest Now, Decrypt Later' in Real Systems</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Migration is mixed-version for years: compatibility and rollback are security features.</li>\n<li>Hybrid composition must be explicit and transcript-bound to resist downgrade.</li>\n<li>PQC changes handshake costs; plan DoS defenses and budgets.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>PQC changes bandwidth and CPU costs; DoS surfaces move.</li>\n<li>Hybrid designs fail if binding is ambiguous (mix-and-match, downgrade).</li>\n<li>Interop is the real risk: multiple stacks, vendors, and versions.</li>\n<li>Operationalization (monitoring, rollback) determines success more than crypto choice.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which parts must be constant-time, and how will you validate that?</li>\n<li>How do you bind hybrid secrets to prevent downgrade and mix-and-match attacks?</li>\n<li>What does interoperability testing look like across vendors and stacks?</li>\n<li>What telemetry proves PQC is working (not just enabled)?</li>\n<li>How do you handle failures: decryption failures, invalid ciphertexts, malformed keys?</li>\n<li>Which secrets require long-term confidentiality (HNDL) and where are they today?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Vendors vary: implementations and defaults differ.</li>\n<li>Side channels exist: timing and cache behavior leak information.</li>\n<li>Bandwidth is limited in some environments; larger handshakes matter.</li>\n<li>Deployments are mixed; old clients must interoperate or fail safely.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating migration as a single flag flip.</li>\n<li>Assuming PQC is “drop-in” without changing operational processes.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A KEM gives you shared secrets without discrete-log assumptions:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">y</mi><mi mathvariant=\"normal\">G</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mo stretchy=\"false\">(</mo><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">)</mo><mo>←</mo><mrow><mi mathvariant=\"normal\">E</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">k</mi></mrow><mo stretchy=\"false\">)</mo><mo separator=\"true\">;</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>←</mo><mrow><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">k</mi></mrow><mo separator=\"true\">,</mo><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">(\\mathrm{pk},\\mathrm{sk})\\leftarrow \\mathrm{KeyGen}();\\ \n(\\mathrm{ct},\\mathrm{ss})\\leftarrow \\mathrm{Enc}(\\mathrm{pk});\\ \n\\mathrm{ss}\\leftarrow \\mathrm{Dec}(\\mathrm{sk},\\mathrm{ct}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">KeyGen</span></span><span class=\"mopen\">(</span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Enc</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">pk</span></span><span class=\"mclose\">)</span><span class=\"mpunct\">;</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ss</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Dec</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">sk</span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ct</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat algorithm negotiation as adversarial: explicit downgrade resistance.</p>\n<p>Make costs explicit: measure CPU and bandwidth, then add protections.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> A as Initiator\n  <span class=\"token keyword\">participant</span> B as Responder\n  A<span class=\"token arrow operator\">->></span>B<span class=\"token operator\">:</span> classical_keyshare + pqc_pk\n  B<span class=\"token arrow operator\">-->></span>A<span class=\"token operator\">:</span> classical_keyshare + pqc_ct + sig\n  A<span class=\"token arrow operator\">-->></span>B<span class=\"token operator\">:</span> sig\n  <span class=\"token keyword\">Note over</span> A,B<span class=\"token operator\">:</span> ss = HKDF<span class=\"token text string\">(ss_classical || ss_pqc, transcript)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Explicit binding prevents downgrade and mix-and-match. Don’t leave it implicit.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Hybrid handshake checklist:\n- Explicit negotiation (no silent downgrade)\n- Transcript-bound KDF\n- DoS protections (rate limits, cookies, puzzles)\n- Constant-time operations\n- Telemetry: which mode, which failures, which clients</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Downgrade tests</strong>: active attacker manipulates negotiation.</li>\n<li><strong>Interop matrices</strong> across vendors/versions and failure modes.</li>\n<li><strong>Side-channel tests</strong> where tooling exists; constant-time audits.</li>\n<li><strong>Chaos deploys</strong>: mixed versions + rollback during partial outages.</li>\n<li><strong>DoS tests</strong>: measure CPU/bandwidth amplification and mitigation impact.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Roll out with canaries and explicit rollback triggers.</li>\n<li>Add telemetry for negotiation outcomes, failures, and client cohorts.</li>\n<li>Inventory long-lived secrets and migrate the highest-risk first.</li>\n<li>Cap handshake cost per peer/IP; use stateless cookies when needed.</li>\n<li>Document supported algorithm sets and deprecation timelines.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Useful when discussing hybrid binding and context separation.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> <span class=\"citation\" id=\"citation--nistpqc--2\">(<a href=\"#bib-nistpqc\">2</a>)</span> — Standardization process and algorithm selections.\n<ul>\n<li><strong>Evidence:</strong> Treat PQ migration as a program (inventory, interop, rollback). Use NIST status to drive prioritization and timelines.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you rotate algorithms without introducing configuration chaos?</li>\n<li>Which clients will fail first, and what is the safe fallback behavior?</li>\n<li>What is the worst-case handshake cost under attack?</li>\n<li>Where would a downgrade be visible today, and how would you detect it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://pq-crystals.org/kyber/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Kyber</a> — KEM design and parameters commonly referenced in deployments.</li>\n<li><a href=\"https://pq-crystals.org/dilithium/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CRYSTALS-Dilithium</a> — Signature scheme design and deployment constraints.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Useful when discussing hybrid binding and context separation.</li>\n<li><a href=\"https://csrc.nist.gov/projects/post-quantum-cryptography\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST Post-Quantum Cryptography Project</a> — Standardization process and algorithm selections.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-nistpqc\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">National Institute of Standards and Technology (NIST). Post-Quantum Cryptography [Internet]. Web; Available from: https://csrc.nist.gov/projects/post-quantum-cryptography</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2023-01-pqc-threat-models-harvest-now-decrypt-later-in-real-systems",
            "title": "PQC Threat Models: 'Harvest Now, Decrypt Later' in Real Systems",
            "summary": "Design memo (January 2023): PQC Threat Models: 'Harvest Now, Decrypt Later' in Real Systems.",
            "date_modified": "2023-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "post-quantum-cryptography",
                "cryptography",
                "security",
                "protocol-design"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-12-red-teaming-infrastructure-turning-attacks-into-regression-t",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Red Teaming Infrastructure: Turning Attacks into Regression Tests</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Rollbacks must be executed under time pressure.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Trusting CI environments by default.</li>\n<li>Assuming deploy equals success without runtime evidence.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-12-red-teaming-infrastructure-turning-attacks-into-regression-t",
            "title": "Red Teaming Infrastructure: Turning Attacks into Regression Tests",
            "summary": "Threat-model-first analysis (December 2022): Red Teaming Infrastructure: Turning Attacks into Regression Tests.",
            "date_modified": "2022-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-11-rust-go-secure-coding-patterns-the-bugs-that-still-happen",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Rust/Go Secure Coding Patterns: The Bugs That Still Happen</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Infrastructure-as-code without policy is just scripting the attack surface.</li>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming deploy equals success without runtime evidence.</li>\n<li>Long-lived credentials embedded in pipelines.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Treat CI as untrusted: keep tokens short-lived and scoped.</span>\n<span class=\"token keyword\">type</span> Token <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  Value <span class=\"token builtin\">string</span>\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n  Scope <span class=\"token builtin\">string</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-11-rust-go-secure-coding-patterns-the-bugs-that-still-happen",
            "title": "Rust/Go Secure Coding Patterns: The Bugs That Still Happen",
            "summary": "Adversarial-first deep dive (November 2022): Rust/Go Secure Coding Patterns: The Bugs That Still Happen.",
            "date_modified": "2022-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-10-secure-configuration-policy-as-code-and-guardrails",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secure Configuration: Policy-as-Code and Guardrails</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n<li>Trusting CI environments by default.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  pr<span class=\"token text string\">[\"PR\"]</span> <span class=\"token arrow operator\">--></span> checks<span class=\"token text string\">[\"Checks\"]</span>\n  checks <span class=\"token arrow operator\">--></span> merge<span class=\"token text string\">[\"Merge\"]</span>\n  merge <span class=\"token arrow operator\">--></span> release<span class=\"token text string\">[\"Release\"]</span>\n  release <span class=\"token arrow operator\">--></span> canary<span class=\"token text string\">[\"Canary\"]</span>\n  canary <span class=\"token arrow operator\">--></span> prod<span class=\"token text string\">[\"Prod\"]</span>\n  prod <span class=\"token arrow operator\">--></span> rollback<span class=\"token text string\">[\"Rollback Plan\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Build systems that can prove what happened after an incident.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-10-secure-configuration-policy-as-code-and-guardrails",
            "title": "Secure Configuration: Policy-as-Code and Guardrails",
            "summary": "Spec-driven research note (October 2022): Secure Configuration: Policy-as-Code and Guardrails.",
            "date_modified": "2022-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-09-backup-restore-as-a-protocol-rpo-rto-with-adversaries",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Backup/Restore as a Protocol: RPO/RTO with Adversaries</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Short-lived credentials (OIDC) beat long-lived tokens in pipelines.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming deploy equals success without runtime evidence.</li>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  pr<span class=\"token text string\">[\"PR\"]</span> <span class=\"token arrow operator\">--></span> checks<span class=\"token text string\">[\"Checks\"]</span>\n  checks <span class=\"token arrow operator\">--></span> merge<span class=\"token text string\">[\"Merge\"]</span>\n  merge <span class=\"token arrow operator\">--></span> release<span class=\"token text string\">[\"Release\"]</span>\n  release <span class=\"token arrow operator\">--></span> canary<span class=\"token text string\">[\"Canary\"]</span>\n  canary <span class=\"token arrow operator\">--></span> prod<span class=\"token text string\">[\"Prod\"]</span>\n  prod <span class=\"token arrow operator\">--></span> rollback<span class=\"token text string\">[\"Rollback Plan\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer short-lived credentials (OIDC) and explicit policy gates.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-09-backup-restore-as-a-protocol-rpo-rto-with-adversaries",
            "title": "Backup/Restore as a Protocol: RPO/RTO with Adversaries",
            "summary": "Adversarial-first deep dive (September 2022): Backup/Restore as a Protocol: RPO/RTO with Adversaries.",
            "date_modified": "2022-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-08-observability-at-scale-traces-cardinality-and-cost",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Observability at Scale: Traces, Cardinality, and Cost</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Short-lived credentials (OIDC) beat long-lived tokens in pipelines.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Infrastructure-as-code without policy is just scripting the attack surface.</li>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you do safe rollouts (canary, blast-radius, rapid rollback)?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n<li>Assuming deploy equals success without runtime evidence.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Build systems that can prove what happened after an incident.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Treat CI as untrusted: keep tokens short-lived and scoped.</span>\n<span class=\"token keyword\">type</span> Token <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  Value <span class=\"token builtin\">string</span>\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n  Scope <span class=\"token builtin\">string</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-08-observability-at-scale-traces-cardinality-and-cost",
            "title": "Observability at Scale: Traces, Cardinality, and Cost",
            "summary": "Spec-driven research note (August 2022): Observability at Scale: Traces, Cardinality, and Cost.",
            "date_modified": "2022-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-07-rate-limiting-load-shedding-protecting-reliability-slos",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Rate Limiting &#x26; Load Shedding: Protecting Reliability SLOs</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Short-lived credentials (OIDC) beat long-lived tokens in pipelines.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n<li>Infrastructure-as-code without policy is just scripting the attack surface.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n<li>Long-lived credentials embedded in pipelines.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Build systems that can prove what happened after an incident.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Treat CI as untrusted: keep tokens short-lived and scoped.</span>\n<span class=\"token keyword\">type</span> Token <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  Value <span class=\"token builtin\">string</span>\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n  Scope <span class=\"token builtin\">string</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-07-rate-limiting-load-shedding-protecting-reliability-slos",
            "title": "Rate Limiting & Load Shedding: Protecting Reliability SLOs",
            "summary": "Engineering notebook entry (July 2022): Rate Limiting & Load Shedding: Protecting Reliability SLOs.",
            "date_modified": "2022-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-06-multi-region-design-failover-that-you-can-actually-test",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Multi-Region Design: Failover That You Can Actually Test</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming deploy equals success without runtime evidence.</li>\n<li>Trusting CI environments by default.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  pr<span class=\"token text string\">[\"PR\"]</span> <span class=\"token arrow operator\">--></span> checks<span class=\"token text string\">[\"Checks\"]</span>\n  checks <span class=\"token arrow operator\">--></span> merge<span class=\"token text string\">[\"Merge\"]</span>\n  merge <span class=\"token arrow operator\">--></span> release<span class=\"token text string\">[\"Release\"]</span>\n  release <span class=\"token arrow operator\">--></span> canary<span class=\"token text string\">[\"Canary\"]</span>\n  canary <span class=\"token arrow operator\">--></span> prod<span class=\"token text string\">[\"Prod\"]</span>\n  prod <span class=\"token arrow operator\">--></span> rollback<span class=\"token text string\">[\"Rollback Plan\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-06-multi-region-design-failover-that-you-can-actually-test",
            "title": "Multi-Region Design: Failover That You Can Actually Test",
            "summary": "Threat-model-first analysis (June 2022): Multi-Region Design: Failover That You Can Actually Test.",
            "date_modified": "2022-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-05-kubernetes-hardening-rbac-networkpolicy-and-pod-security",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Kubernetes Hardening: RBAC, NetworkPolicy, and Pod Security</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Short-lived credentials (OIDC) beat long-lived tokens in pipelines.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you do safe rollouts (canary, blast-radius, rapid rollback)?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>Rollbacks must be executed under time pressure.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Long-lived credentials embedded in pipelines.</li>\n<li>Assuming deploy equals success without runtime evidence.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  pr<span class=\"token text string\">[\"PR\"]</span> <span class=\"token arrow operator\">--></span> checks<span class=\"token text string\">[\"Checks\"]</span>\n  checks <span class=\"token arrow operator\">--></span> merge<span class=\"token text string\">[\"Merge\"]</span>\n  merge <span class=\"token arrow operator\">--></span> release<span class=\"token text string\">[\"Release\"]</span>\n  release <span class=\"token arrow operator\">--></span> canary<span class=\"token text string\">[\"Canary\"]</span>\n  canary <span class=\"token arrow operator\">--></span> prod<span class=\"token text string\">[\"Prod\"]</span>\n  prod <span class=\"token arrow operator\">--></span> rollback<span class=\"token text string\">[\"Rollback Plan\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Build systems that can prove what happened after an incident.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-05-kubernetes-hardening-rbac-networkpolicy-and-pod-security",
            "title": "Kubernetes Hardening: RBAC, NetworkPolicy, and Pod Security",
            "summary": "Threat-model-first analysis (May 2022): Kubernetes Hardening: RBAC, NetworkPolicy, and Pod Security.",
            "date_modified": "2022-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-04-runtime-security-ebpf-policy-and-drift-detection",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Runtime Security: eBPF, Policy, and Drift Detection</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you do safe rollouts (canary, blast-radius, rapid rollback)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Trusting CI environments by default.</li>\n<li>Long-lived credentials embedded in pipelines.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-04-runtime-security-ebpf-policy-and-drift-detection",
            "title": "Runtime Security: eBPF, Policy, and Drift Detection",
            "summary": "Adversarial-first deep dive (April 2022): Runtime Security: eBPF, Policy, and Drift Detection.",
            "date_modified": "2022-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-03-secrets-hygiene-rotation-scoping-and-runtime-delivery",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secrets Hygiene: Rotation, Scoping, and Runtime Delivery</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Supply-chain attacks target your CI/CD because it has keys and reach.</li>\n<li>Infrastructure-as-code without policy is just scripting the attack surface.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you do safe rollouts (canary, blast-radius, rapid rollback)?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Trusting CI environments by default.</li>\n<li>Long-lived credentials embedded in pipelines.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A policy gate is a predicate over metadata:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">w</mi></mrow><mo stretchy=\"false\">(</mo><mtext>deploy</mtext><mo stretchy=\"false\">)</mo><mo>⇔</mo><mi>P</mi><mo stretchy=\"false\">(</mo><mtext>attestation</mtext><mo separator=\"true\">,</mo><mtext> scan</mtext><mo separator=\"true\">,</mo><mtext> env</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{allow}(\\text{deploy}) \\Leftrightarrow P(\\text{attestation},\\ \\text{scan},\\ \\text{env}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">allow</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">deploy</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇔</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">P</span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">attestation</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">scan</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">env</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Policy should be code with diffs and reviews—guardrails, not guidelines.</p>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  pr<span class=\"token text string\">[\"PR\"]</span> <span class=\"token arrow operator\">--></span> checks<span class=\"token text string\">[\"Checks\"]</span>\n  checks <span class=\"token arrow operator\">--></span> merge<span class=\"token text string\">[\"Merge\"]</span>\n  merge <span class=\"token arrow operator\">--></span> release<span class=\"token text string\">[\"Release\"]</span>\n  release <span class=\"token arrow operator\">--></span> canary<span class=\"token text string\">[\"Canary\"]</span>\n  canary <span class=\"token arrow operator\">--></span> prod<span class=\"token text string\">[\"Prod\"]</span>\n  prod <span class=\"token arrow operator\">--></span> rollback<span class=\"token text string\">[\"Rollback Plan\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CI hardening checklist:\n- No long-lived secrets in CI\n- OIDC to obtain short-lived creds\n- Pin dependencies and verify integrity\n- Reproducible builds + provenance attestation\n- Policy-as-code gates (deploy blocked on evidence)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-03-secrets-hygiene-rotation-scoping-and-runtime-delivery",
            "title": "Secrets Hygiene: Rotation, Scoping, and Runtime Delivery",
            "summary": "Adversarial-first deep dive (March 2022): Secrets Hygiene: Rotation, Scoping, and Runtime Delivery.",
            "date_modified": "2022-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-02-reproducible-ci-cd-determinism-as-defense",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Reproducible CI/CD: Determinism as Defense</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Treat CI/CD as attacker-controlled until proven otherwise; minimize secrets and privileges.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Infrastructure-as-code without policy is just scripting the attack surface.</li>\n<li>Policy drift is the default; guardrails must be automated and enforced.</li>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>What is the minimum set of humans who can ship to production?</li>\n<li>What is your supply-chain threat model (dependency poisoning, CI compromise)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Rollbacks must be executed under time pressure.</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Long-lived credentials embedded in pipelines.</li>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The pipeline is production: it has credentials, network reach, and authority.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Treat CI as untrusted: keep tokens short-lived and scoped.</span>\n<span class=\"token keyword\">type</span> Token <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  Value <span class=\"token builtin\">string</span>\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n  Scope <span class=\"token builtin\">string</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-02-reproducible-ci-cd-determinism-as-defense",
            "title": "Reproducible CI/CD: Determinism as Defense",
            "summary": "Engineering notebook entry (February 2022): Reproducible CI/CD: Determinism as Defense.",
            "date_modified": "2022-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2022-01-supply-chain-security-slsa-sbom-and-build-provenance",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>DevSecOps &#x26; Resilience Engineering</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Supply Chain Security: SLSA, SBOM, and Build Provenance</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make rollback a first-class operation with explicit triggers and rehearsal.</li>\n<li>Policy-as-code needs tests, rollout, and rollback like any other production system.</li>\n<li>Provenance is a cryptographic statement; ship evidence with artifacts.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Reproducibility is how you know what you shipped is what you built.</li>\n<li>Runtime security needs evidence pipelines, not just dashboards.</li>\n<li>Rollouts are where incidents happen; safe rollback is a security feature.</li>\n<li>Secrets in CI turn “one compromised job” into “full compromise.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent “break glass” from becoming the standard path?</li>\n<li>How do you rehearse incident response as code (runbooks, chaos, drills)?</li>\n<li>Where do you enforce policy (pre-merge, build, deploy, runtime)?</li>\n<li>How do you manage secrets without long-lived credentials in CI?</li>\n<li>Which signals prove correctness (not just availability) in production?</li>\n<li>How do you do safe rollouts (canary, blast-radius, rapid rollback)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>CI runners are exposed to untrusted code (PRs, dependencies).</li>\n<li>Dependencies can be compromised upstream (typosquatting, maintainer takeover).</li>\n<li>Policy enforcement must be consistent across environments.</li>\n<li>Observability pipelines can be attacked (log injection, PII leaks).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Manual policy enforcement or manual security review as the only control.</li>\n<li>Assuming deploy equals success without runtime evidence.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Build provenance is a cryptographic statement:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>build</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>artifact</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{attest} \\leftarrow \\mathrm{Sign}_{k_\\text{build}}(\\mathrm{hash}(\\text{artifact})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6151em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">attest</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">build</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">artifact</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat CI as attacker-controlled until proven otherwise; minimize secrets and privileges.</p>\n<p>Make provenance verifiable: “what built this” must be cryptographically bound.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  src<span class=\"token text string\">[\"Source\"]</span> <span class=\"token arrow operator\">--></span> build<span class=\"token text string\">[\"Build (reproducible)\"]</span>\n  build <span class=\"token arrow operator\">--></span> attest<span class=\"token text string\">[\"Attestation\"]</span>\n  attest <span class=\"token arrow operator\">--></span> scan<span class=\"token text string\">[\"SAST/DAST/SCA\"]</span>\n  scan <span class=\"token arrow operator\">--></span> deploy<span class=\"token text string\">[\"Deploy (policy gates)\"]</span>\n  deploy <span class=\"token arrow operator\">--></span> runtime<span class=\"token text string\">[\"Runtime Policy + Observability\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer short-lived credentials (OIDC) and explicit policy gates.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Treat CI as untrusted: keep tokens short-lived and scoped.</span>\n<span class=\"token keyword\">type</span> Token <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  Value <span class=\"token builtin\">string</span>\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n  Scope <span class=\"token builtin\">string</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rollback tests</strong> as part of release (not “if needed”).</li>\n<li><strong>Runtime conformance</strong>: detect drift between desired and actual state.</li>\n<li><strong>Policy tests</strong>: unit tests for policy-as-code rules.</li>\n<li><strong>Dependency tampering drills</strong>: lockfile changes, integrity failures.</li>\n<li><strong>Pipeline attack simulations</strong>: compromise a runner and measure blast radius.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse incident response for the pipeline itself.</li>\n<li>Continuously scan and inventory dependencies; prioritize by exposure.</li>\n<li>Keep a provenance trail for every artifact deployed to production.</li>\n<li>Audit who can ship and how; remove implicit paths.</li>\n<li>Treat policy changes as security-sensitive deploys (review + rollout).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke all pipeline credentials in an incident?</li>\n<li>Can you answer “what code is running” with cryptographic evidence?</li>\n<li>What is the smallest CI compromise that becomes a prod compromise today?</li>\n<li>Which deploy actions are irreversible and how do you mitigate that?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-218/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-218 (SSDF)</a> — Secure software development practices as an engineering framework.</li>\n<li><a href=\"https://in-toto.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">in-toto</a> — Securing the integrity of software supply chains with attestations.</li>\n<li><a href=\"https://www.sigstore.dev/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Sigstore</a> — Signing and verifying artifacts at scale with transparency logs.</li>\n<li><a href=\"https://slsa.dev/spec/v1.0/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">SLSA v1.0 Specification</a> — Supply-chain levels and provenance requirements.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2022-01-supply-chain-security-slsa-sbom-and-build-provenance",
            "title": "Supply Chain Security: SLSA, SBOM, and Build Provenance",
            "summary": "Spec-driven research note (January 2022): Supply Chain Security: SLSA, SBOM, and Build Provenance.",
            "date_modified": "2022-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "DevSecOps",
                "security",
                "resilience",
                "security-critical-infrastructure"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-12-post-quantum-readiness-at-the-edge-constraints-and-migration",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Post-Quantum Readiness at the Edge: Constraints and Migration</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming firmware updates always complete successfully.</li>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Fleet rollout safety is a monotone constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>rollout</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mtext>can_rollback</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mi>k</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∧</mo><mtext> telemetry_healthy</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{rollout}(v_{k+1}) \\Rightarrow \\text{can\\_rollback}(v_k)\\ \\wedge\\ \\text{telemetry\\_healthy}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">rollout</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.06em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">can_rollback</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">telemetry_healthy</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Edge security is about recovery: safe defaults, staged updates, and fast revocation.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-12-post-quantum-readiness-at-the-edge-constraints-and-migration",
            "title": "Post-Quantum Readiness at the Edge: Constraints and Migration",
            "summary": "Engineering notebook entry (December 2021): Post-Quantum Readiness at the Edge: Constraints and Migration.",
            "date_modified": "2021-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-11-anomaly-detection-what-baseline-means-in-industrial-systems",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Anomaly Detection: What 'Baseline' Means in Industrial Systems</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>What does incident response look like at fleet scale?</li>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n<li>Treating identity as a static certificate file.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Fleet rollout safety is a monotone constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>rollout</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mtext>can_rollback</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mi>k</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∧</mo><mtext> telemetry_healthy</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{rollout}(v_{k+1}) \\Rightarrow \\text{can\\_rollback}(v_k)\\ \\wedge\\ \\text{telemetry\\_healthy}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">rollout</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.06em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">can_rollback</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">telemetry_healthy</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat the gateway as a security boundary, not a dumb proxy.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-11-anomaly-detection-what-baseline-means-in-industrial-systems",
            "title": "Anomaly Detection: What 'Baseline' Means in Industrial Systems",
            "summary": "Threat-model-first analysis (November 2021): Anomaly Detection: What 'Baseline' Means in Industrial Systems.",
            "date_modified": "2021-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-10-secure-remote-access-bastions-just-in-time-and-audit",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secure Remote Access: Bastions, Just-in-Time, and Audit</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>What does incident response look like at fleet scale?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming firmware updates always complete successfully.</li>\n<li>Treating identity as a static certificate file.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Fleet rollout safety is a monotone constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>rollout</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mtext>can_rollback</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mi>k</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∧</mo><mtext> telemetry_healthy</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{rollout}(v_{k+1}) \\Rightarrow \\text{can\\_rollback}(v_k)\\ \\wedge\\ \\text{telemetry\\_healthy}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">rollout</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.06em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">can_rollback</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">telemetry_healthy</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat the gateway as a security boundary, not a dumb proxy.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-10-secure-remote-access-bastions-just-in-time-and-audit",
            "title": "Secure Remote Access: Bastions, Just-in-Time, and Audit",
            "summary": "Spec-driven research note (October 2021): Secure Remote Access: Bastions, Just-in-Time, and Audit.",
            "date_modified": "2021-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-09-offline-first-edge-consistency-during-intermittent-connectiv",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Offline-First Edge: Consistency During Intermittent Connectivity</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>What does incident response look like at fleet scale?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n<li>Devices experience power loss and abrupt restarts.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n<li>Assuming firmware updates always complete successfully.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Fleet rollout safety is a monotone constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>rollout</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mtext>can_rollback</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mi>k</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∧</mo><mtext> telemetry_healthy</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{rollout}(v_{k+1}) \\Rightarrow \\text{can\\_rollback}(v_k)\\ \\wedge\\ \\text{telemetry\\_healthy}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">rollout</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.06em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">can_rollback</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">telemetry_healthy</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer protocols that degrade safely under packet loss and skew.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-09-offline-first-edge-consistency-during-intermittent-connectiv",
            "title": "Offline-First Edge: Consistency During Intermittent Connectivity",
            "summary": "Spec-driven research note (September 2021): Offline-First Edge: Consistency During Intermittent Connectivity.",
            "date_modified": "2021-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-08-safety-critical-vs-security-critical-integrating-two-worlds",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Safety-Critical vs Security-Critical: Integrating Two Worlds</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>What does incident response look like at fleet scale?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect time synchronization at the edge.</li>\n<li>Assuming firmware updates always complete successfully.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Edge security is about recovery: safe defaults, staged updates, and fast revocation.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-08-safety-critical-vs-security-critical-integrating-two-worlds",
            "title": "Safety-Critical vs Security-Critical: Integrating Two Worlds",
            "summary": "Correctness-focused deep dive (August 2021): Safety-Critical vs Security-Critical: Integrating Two Worlds.",
            "date_modified": "2021-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-07-gateway-architecture-protocol-translation-without-becoming-a",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Gateway Architecture: Protocol Translation Without Becoming a Bottleneck</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you provision identity and rotate it over years?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n<li>What does incident response look like at fleet scale?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Some devices are physically accessible to attackers.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming firmware updates always complete successfully.</li>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat the gateway as a security boundary, not a dumb proxy.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-07-gateway-architecture-protocol-translation-without-becoming-a",
            "title": "Gateway Architecture: Protocol Translation Without Becoming a Bottleneck",
            "summary": "Spec-driven research note (July 2021): Gateway Architecture: Protocol Translation Without Becoming a Bottleneck.",
            "date_modified": "2021-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-06-time-series-at-scale-ingestion-downsampling-and-query-isolat",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Time-Series at Scale: Ingestion, Downsampling, and Query Isolation</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Define safety properties before performance goals.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>What does incident response look like at fleet scale?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n<li>Some devices are physically accessible to attackers.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming firmware updates always complete successfully.</li>\n<li>Assuming perfect time synchronization at the edge.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer protocols that degrade safely under packet loss and skew.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-06-time-series-at-scale-ingestion-downsampling-and-query-isolat",
            "title": "Time-Series at Scale: Ingestion, Downsampling, and Query Isolation",
            "summary": "Design memo (June 2021): Time-Series at Scale: Ingestion, Downsampling, and Query Isolation.",
            "date_modified": "2021-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-05-zero-trust-for-iiot-network-segmentation-and-policy-enforcem",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Zero Trust for IIoT: Network Segmentation and Policy Enforcement</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>What does incident response look like at fleet scale?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating identity as a static certificate file.</li>\n<li>Assuming firmware updates always complete successfully.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer protocols that degrade safely under packet loss and skew.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Anti-replay sketch: monotonic counter + bounded window.</span>\n<span class=\"token keyword\">type</span> Counter <span class=\"token builtin\">uint64</span>\n<span class=\"token keyword\">type</span> SeenStore <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">MaxCounter</span><span class=\"token punctuation\">(</span>deviceID <span class=\"token builtin\">string</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>Counter<span class=\"token punctuation\">,</span> <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n  <span class=\"token function\">UpdateMax</span><span class=\"token punctuation\">(</span>deviceID <span class=\"token builtin\">string</span><span class=\"token punctuation\">,</span> c Counter<span class=\"token punctuation\">)</span> <span class=\"token builtin\">error</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-05-zero-trust-for-iiot-network-segmentation-and-policy-enforcem",
            "title": "Zero Trust for IIoT: Network Segmentation and Policy Enforcement",
            "summary": "Correctness-focused deep dive (May 2021): Zero Trust for IIoT: Network Segmentation and Policy Enforcement.",
            "date_modified": "2021-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-04-firmware-update-pipelines-rollouts-canary-and-recovery",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Firmware Update Pipelines: Rollouts, Canary, and Recovery</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does incident response look like at fleet scale?</li>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming firmware updates always complete successfully.</li>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat device identity as a lifecycle: provision → attest → rotate → revoke → forensics.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat the gateway as a security boundary, not a dumb proxy.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Anti-replay sketch: monotonic counter + bounded window.</span>\n<span class=\"token keyword\">type</span> Counter <span class=\"token builtin\">uint64</span>\n<span class=\"token keyword\">type</span> SeenStore <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">MaxCounter</span><span class=\"token punctuation\">(</span>deviceID <span class=\"token builtin\">string</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>Counter<span class=\"token punctuation\">,</span> <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n  <span class=\"token function\">UpdateMax</span><span class=\"token punctuation\">(</span>deviceID <span class=\"token builtin\">string</span><span class=\"token punctuation\">,</span> c Counter<span class=\"token punctuation\">)</span> <span class=\"token builtin\">error</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-04-firmware-update-pipelines-rollouts-canary-and-recovery",
            "title": "Firmware Update Pipelines: Rollouts, Canary, and Recovery",
            "summary": "Threat-model-first analysis (April 2021): Firmware Update Pipelines: Rollouts, Canary, and Recovery.",
            "date_modified": "2021-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-03-edge-to-cloud-messaging-mqtt-opc-ua-and-threat-models",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Edge-to-Cloud Messaging: MQTT, OPC UA, and Threat Models</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>What does incident response look like at fleet scale?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n<li>Devices experience power loss and abrupt restarts.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on the cloud to enforce edge-local safety properties.</li>\n<li>Assuming firmware updates always complete successfully.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer protocols that degrade safely under packet loss and skew.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-03-edge-to-cloud-messaging-mqtt-opc-ua-and-threat-models",
            "title": "Edge-to-Cloud Messaging: MQTT, OPC UA, and Threat Models",
            "summary": "Engineering notebook entry (March 2021): Edge-to-Cloud Messaging: MQTT, OPC UA, and Threat Models.",
            "date_modified": "2021-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-02-secure-telemetry-integrity-nonce-discipline-and-replay-prote",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Secure Telemetry: Integrity, Nonce Discipline, and Replay Protection</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Device identity is a lifecycle: provision → attest → rotate → revoke → forensics.</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Secure updates need rollback protection and staged rollout with safety rails.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Identity and freshness are the foundation of telemetry integrity.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n<li>Fleet-scale updates turn bugs into global incidents; rollback must be engineered.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does incident response look like at fleet scale?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>What is your offline behavior (safe mode vs degraded mode)?</li>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you handle intermittent connectivity without corrupting state?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Some devices are physically accessible to attackers.</li>\n<li>Gateways can be compromised; isolate blast radius.</li>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating identity as a static certificate file.</li>\n<li>Assuming perfect time synchronization at the edge.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Fleet rollout safety is a monotone constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>rollout</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mrow><mi>k</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mtext>can_rollback</mtext><mo stretchy=\"false\">(</mo><msub><mi>v</mi><mi>k</mi></msub><mo stretchy=\"false\">)</mo><mtext> </mtext><mo>∧</mo><mtext> telemetry_healthy</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{rollout}(v_{k+1}) \\Rightarrow \\text{can\\_rollback}(v_k)\\ \\wedge\\ \\text{telemetry\\_healthy}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">rollout</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.06em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">can_rollback</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03588em;\">v</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0359em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord text\"><span class=\"mord\">telemetry_healthy</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> D as Device\n  <span class=\"token keyword\">participant</span> G as Gateway\n  <span class=\"token keyword\">participant</span> C as Cloud\n  D<span class=\"token arrow operator\">->></span>G<span class=\"token operator\">:</span> telemetry<span class=\"token text string\">(nonce, ctr, sig)</span>\n  G<span class=\"token arrow operator\">->></span>C<span class=\"token operator\">:</span> forward + policy tags\n  C<span class=\"token arrow operator\">-->></span>G<span class=\"token operator\">:</span> update policy\n  G<span class=\"token arrow operator\">-->></span>D<span class=\"token operator\">:</span> commands <span class=\"token text string\">(bounded)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Edge security is about recovery: safe defaults, staged updates, and fast revocation.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What is the blast radius of a compromised gateway?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-02-secure-telemetry-integrity-nonce-discipline-and-replay-prote",
            "title": "Secure Telemetry: Integrity, Nonce Discipline, and Replay Protection",
            "summary": "Correctness-focused deep dive (February 2021): Secure Telemetry: Integrity, Nonce Discipline, and Replay Protection.",
            "date_modified": "2021-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2021-01-device-identity-provisioning-attestation-and-lifecycle",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>IIoT Platforms &#x26; Edge Security</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Device Identity: Provisioning, Attestation, and Lifecycle</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Design for power loss and intermittent links; recovery is the primary feature.</li>\n<li>Gateways are security boundaries; isolate blast radius and enforce policy early.</li>\n<li>Replay protection must not rely on wall-clock time alone (counters + windows).</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Edge systems fail differently: power loss, intermittent links, and physical access.</li>\n<li>Gateways become choke points; design them as security boundaries.</li>\n<li>Operational constraints (bandwidth, CPU) drive protocol choices.</li>\n<li>Adversaries can replay and spoof data to mislead control planes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you terminate trust (device, gateway, cloud) and why?</li>\n<li>How do you prevent replay and reordering from becoming false control signals?</li>\n<li>What does incident response look like at fleet scale?</li>\n<li>How do you do secure updates (rollback protection, staged rollout, recovery)?</li>\n<li>How do you provision identity and rotate it over years?</li>\n<li>How do devices enroll securely (no shared secrets, minimal manual steps)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Firmware updates can fail mid-flight; partial installation is possible.</li>\n<li>Devices experience power loss and abrupt restarts.</li>\n<li>Connectivity is intermittent and high-latency; retries amplify costs.</li>\n<li>Time sync is weak; clocks drift and may be manipulated.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming perfect time synchronization at the edge.</li>\n<li>Treating identity as a static certificate file.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>At the edge, identity and freshness are everything. A typical anti-replay constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>accept</mtext><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">e</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">∉</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi></mrow><mtext> </mtext><mo>∧</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">s</mi></mrow><mo stretchy=\"false\">(</mo><mi>m</mi><mo stretchy=\"false\">)</mo><mo>∈</mo><mo stretchy=\"false\">[</mo><mi>t</mi><mo>−</mo><mi mathvariant=\"normal\">Δ</mi><mo separator=\"true\">,</mo><mi>t</mi><mo>+</mo><mi mathvariant=\"normal\">Δ</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{accept}(m)\\Rightarrow \\mathrm{nonce}(m)\\notin \\mathrm{Seen}\\ \\wedge\\ \\mathrm{ts}(m)\\in [t-\\Delta,t+\\Delta].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">accept</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">nonce</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mord\"><span class=\"mrel\">∈</span></span><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"llap\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mord\">/</span><span class=\"mspace\" style=\"margin-right:0.0556em;\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Seen</span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">ts</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">m</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∈</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">−</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\">Δ</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">Δ</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Use monotonic counters when time is untrusted; combine with nonces and bounded windows.</p>\n<p>Define safe modes explicitly: what do devices do when policy can’t be fetched?</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  dev<span class=\"token text string\">[\"Device (identity + attestation)\"]</span> <span class=\"token arrow operator\">--></span> gw<span class=\"token text string\">[\"Gateway\"]</span>\n  gw <span class=\"token arrow operator\">--></span> bus<span class=\"token text string\">[\"Message Bus\"]</span>\n  bus <span class=\"token arrow operator\">--></span> ingest<span class=\"token text string\">[\"Ingestion\"]</span>\n  ingest <span class=\"token arrow operator\">--></span> tsdb<span class=\"token text string\">[\"Time-Series Store\"]</span>\n  tsdb <span class=\"token arrow operator\">--></span> apps<span class=\"token text string\">[\"Analytics / Control Plane\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Prefer protocols that degrade safely under packet loss and skew.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Firmware update safety checklist:\n- Signed manifest with version + hash\n- Rollback protection (anti-downgrade)\n- A/B partitions or staged apply\n- Health check + watchdog\n- Telemetry proves rollout state</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Key rotation drills</strong> across device + gateway + cloud.</li>\n<li><strong>Hardware-in-the-loop</strong> tests for update and recovery paths.</li>\n<li><strong>Replay/reorder</strong> simulations for telemetry and control messages.</li>\n<li><strong>Power-loss</strong> fault injection during flash writes and installs.</li>\n<li><strong>Scale tests</strong>: provisioning bursts, reconnect storms, gateway failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Maintain an identity inventory: device → cert/keys → firmware version.</li>\n<li>Make revocation fast: emergency disable, quarantine, and re-enrollment.</li>\n<li>Treat time sync alerts as security signals (NTP manipulation).</li>\n<li>Design rollouts to be interruptible and reversible.</li>\n<li>Monitor fleet health by cohort (version, region, gateway).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the blast radius of a compromised gateway?</li>\n<li>Which messages are allowed to cause physical effects and under what conditions?</li>\n<li>How quickly can you revoke a compromised device identity globally?</li>\n<li>What does “safe behavior” mean when the cloud is unreachable?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/pubs/ir/8259/a/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NISTIR 8259A: IoT Device Cybersecurity Capability Core Baseline</a> — Baseline capabilities and lifecycle expectations for devices.</li>\n<li><a href=\"https://uptane.github.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Uptane</a> — Secure software updates for fleets with realistic threat models.</li>\n<li><a href=\"https://theupdateframework.github.io/specification/latest/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">The Update Framework (TUF) Specification</a> — Secure update metadata, compromise recovery, and key rotation.</li>\n<li><a href=\"https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">MQTT Version 5.0 (OASIS)</a> — Messaging semantics, session behavior, and constraints at the edge.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2021-01-device-identity-provisioning-attestation-and-lifecycle",
            "title": "Device Identity: Provisioning, Attestation, and Lifecycle",
            "summary": "Design memo (January 2021): Device Identity: Provisioning, Attestation, and Lifecycle.",
            "date_modified": "2021-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "IIoT",
                "security-critical-infrastructure",
                "distributed-systems",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-12-spec-driven-development-making-the-spec-the-center-of-gravit",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Spec-Driven Development: Making the Spec the Center of Gravity</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating verification as a one-time event rather than a process.</li>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Write properties in plain language next to the formal version.</p>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep refinement boundaries explicit: what the spec promises vs what code enforces.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Workflow:\n1) Write a model with a few state variables.\n2) State invariants (safety) and progress conditions (liveness).\n3) Run model checker with tight bounds.\n4) Minimize counterexamples into test cases.\n5) Iterate until failures are boring.</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-12-spec-driven-development-making-the-spec-the-center-of-gravit",
            "title": "Spec-Driven Development: Making the Spec the Center of Gravity",
            "summary": "Design memo (December 2020): Spec-Driven Development: Making the Spec the Center of Gravity.",
            "date_modified": "2020-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/boosting-quantum-computer-hardware",
            "content_html": "<p>Google recently announced the release of TensorFlow Quantum - a toolset for combining state-of-the-art machine learning techniques with quantum algorithm design. This was an important step to build tools for developers working on quantum applications - users operating primarily at the “top of the stack”.</p>\n<p>In parallel we’ve been building a complementary TensorFlow-based toolset working from the hardware level up - from the bottom of the stack. Our efforts have focused on improving the performance of quantum computing hardware through the integration of a set of techniques we call quantum firmware.</p>\n<p>In this article we’ll provide an overview of the fundamental driver for this work - combating noise and error in quantum computers - and describe how the team at Q-CTRL uses TensorFlow to efficiently characterize and suppress the impact of noise and imperfections in quantum hardware. These are key challenges in the global effort to make quantum computers useful.</p>\n<p>The Achilles heel of quantum computers - noise and error\nQuantum computing, simply put, is a new way to process information using the laws of quantum physics - the rules that govern nature on tiny size scales. Through decades of effort in science and engineering we’re now ready to put this physics to work solving problems that are exceptionally difficult for regular computers.</p>\n<p>Realizing useful computations on today’s systems requires a recognition that performance is predominantly limited by hardware imperfections and failures, not system size. Susceptibility to noise and error remains the Achilles heel of quantum computers, and ultimately limits the range and utility of algorithms run on quantum computing hardware.</p>\n<p>As a broad community average, most quantum computer hardware can run just a few dozen calculations over a time much less than one millisecond before requiring a reset due to the influence of noise. Depending on the specifics that’s about 1024 times worse than the hardware in a laptop!</p>\n<p>This is the heart of why quantum computing is really hard. In this context, “noise” describes all of the things that cause interference in a quantum computer. Just like a mobile phone call can suffer interference leading it to break up, a quantum computer is susceptible to interference from all sorts of sources, like electromagnetic signals coming from WiFi or disturbances in the Earth’s magnetic field.</p>\n<p>When qubits in a quantum computer are exposed to this kind of noise, the information in them gets degraded just the way sound quality is degraded by interference on a call. In a quantum system this process is known as decoherence. Decoherence causes the information encoded in a quantum computer to become randomized - and this leads to errors when we execute an algorithm. The greater the influence of noise, the shorter the algorithm that can be run.</p>\n<p>So what do we do about this? To start, for the past two decades teams have been working to make their hardware more passively stable - shielding it from the noise that causes decoherence. At the same time theorists have designed a clever algorithm called Quantum Error Correction that can identify and fix errors in the hardware, based in large part on classical error correction codes. This is essential in principle, but the downside is that to make it work you have to spread the information in one qubit over lots of qubits; it may take 1000 or more physical qubits to realize just one error-corrected “logical qubit”. Today’s machines are nowhere near capable of getting benefits from this kind of Quantum Error Correction.</p>\n<p>Q-CTRL adds something extra - quantum firmware - which can stabilize the qubits against noise and decoherence without the need for extra resources. It does this by adding new solutions at the lowest layer of the quantum computing stack that improve the hardware’s robustness to error.</p>\n<p>Building quantum firmware with TensorFlow</p>\n<p>Quantum firmware describes a set of protocols whose purpose is to deliver quantum hardware with augmented performance to higher levels of abstraction in the quantum computing stack. The choice of the term firmware reflects the fact that the relevant routines are usually software-defined but embedded proximal to the physical layer and effectively invisible to higher layers of abstraction.</p>\n<p>Quantum computing hardware generally relies on a form of precisely engineered light-matter interaction in order to enact quantum logic operations. These operations in a sense constitute the native machine language for a quantum computer; a timed pulse of microwaves on resonance with a superconducting qubit can translate to an effective bit-flip operation while another pulse may implement a conditional logic operation between a pair of qubits. An appropriate composition of these electromagnetic signals then implements the target quantum algorithm.</p>\n<p>Quantum firmware determines how the physical hardware should be manipulated, redefining the hardware machine language in a way that improves stability against decoherence. Key to this process is the calculation of noise-robust operations using information gleaned from the hardware itself.</p>\n<p>Building in TensorFlow was essential to moving beyond “home-built’’ code to commercial-grade products for Q-CTRL. Underpinning these techniques (formally coming from the field of quantum control) are tools allowing us to perform complex gradient-based optimizations. We express all optimization problems as data flow graphs, which describe how optimization variables (variables that can be tuned by the optimizer) are transformed into the cost function (the objective that the optimizer attempts to minimize). We combine custom convenience functions with access to TensorFlow primitives in order to efficiently perform optimizations as used in many different parts of our workflow. And critically, we exploit TensorFlow’s efficient gradient calculation tools to address what is often the weakest link in home-built implementations, especially as the analytic form of the relevant function is often nonlinear and contains many complex dependencies.</p>\n<p>For example, consider the case of defining a numerically optimized error-robust quantum bit flip used to manipulate a qubit - the analog of a classical NOT gate. As mentioned above, in a superconducting qubit this is achieved using a pulse of microwaves. We have the freedom to “shape” various aspects of the envelope of the pulse in order to enact the same mathematical transformation in a way that exhibits robustness against common noise sources, such as fluctuations in the strength or frequency of the microwaves.</p>\n<p>To do this we first define the data flow graph used to optimize the manipulation of this qubit - it includes objects that describe available “knobs” to adjust, the sources of noise, and the target operation .</p>\n<p>Once the graph has been defined inside our context manager, an object must be created that ties together the objective function (in this case minimizing the resultant gate error) and the desired outputs defining the shape of the microwave pulse. With the graph object created, an optimization can be run using a service that returns a new graph object containing the results of the optimization.</p>\n<p>This structure allows us to simply create helper functions which enable physically motivated constraints to be built directly into the graph. For instance, these might be symmetry requirements, limits on how a signal changes in time, or even incorporation of characteristics of the electronics systems used to generate the microwave pulses. Any other capabilities not directly covered by this library of helper functions can also be directly coded as TensorFlow primitives.</p>\n<p>With this approach we achieve an extremely flexible and high-performance optimization engine; our direct benchmarking has revealed order-of-magnitude benefits in time to solution relative to the best available alternative architectures.</p>\n<p>The capabilities enabled by this toolkit span the space of tasks required to stabilize quantum computing hardware and reduce errors at the lowest layer of the quantum computing stack. And importantly they’re experimentally verified on real quantum computing hardware; quantum firmware has been shown to reduce the likelihood of errors, mitigate system performance variations across devices, stabilize hardware against slowly drifting out of calibration, and even make quantum logic operations more compatible with higher level abstractions in quantum computing such as quantum error correction. All of these capabilities and real hardware demonstrations are accessible via our publicly available User Guides and Application Notes in executable Jupyter notebook form.</p>\n<p>Ultimately, we believe that building and operating large-scale quantum computing systems will be effectively impossible without the integration of the capabilities encapsulated in quantum firmware. There are many concepts to be drawn from across the fields of machine learning and robotic control in the drive for performance and autonomy, and TensorFlow has proven an efficient language to support the development of the critical toolsets.</p>\n<p>A brief history of QC, from Shor to quantum machine learning\nThe quantum computing boom started in 1994 with the discovery of Shor’s algorithm for factoring large numbers. Public key cryptosystems — which is to say, most encryption — rely on the mathematical complexity of factoring primes to keep messages safe from prying computers. By virtue of their approach to encoding and processing information, however, quantum computers are conjectured to be able to factor primes faster — exponentially faster — than a classical machine. In principle this poses an existential threat not only to national security, but also emerging technologies such as cryptocurrencies.</p>\n<p>This realization set in motion the development of the entire field of quantum computing. Shor’s algorithm spurred the NSA to begin one of its first ever open, University-driven research programs asking the question of whether such systems could be built. Fast forward to 2020 and quantum supremacy has been achieved, meaning that a real quantum computing hardware system has performed a task that’s effectively impossible for even the world’s largest supercomputers.</p>\n<p>Quantum supremacy is an important technical milestone whose practical importance in solving problems of relevance to end users remains a bit unclear. Our community is continuing to make great progress towards quantum advantage - a threshold indicating that it’s actually cheaper or faster to use a quantum computer for a problem of practical relevance. And for the right problems, we think that within the next 5-10 years we’ll cross that threshold with a quantum computer that isn’t that much bigger than the ones we have today. It just needs to perform much better.</p>\n<p>So, which problems are the right problems for quantum computers to address first?</p>\n<p>In many respects, Shor’s algorithm has receded in importance as the scale of the challenge emerged. A recent technical analysis suggests that we’re unlikely to see Shor deployed at a useful scale until 2039. Today, small-scale machines with a couple of dozen interacting qubits exist in labs around the world, built from superconducting circuits, individual trapped atoms, or similarly exotic materials. The problem is that these early machines are just too small and too fragile to solve problems relevant to factoring.</p>\n<p>To factor a number sufficiently large to be relevant in cryptography, one would need a system composed of thousands of qubits capable of handling trillions of operations each. This is nothing for a conventional machine where hardware can run for a billion years at a billion operations per second and never be likely to suffer a fault. But as we’ve seen it’s quite a different story for quantum computers.</p>\n<p>These limits have driven the emergence of a new class of applications in materials science and chemistry that could prove equally impactful, using much smaller systems. Quantum computing in the near term could also help develop new classes of artificial intelligence systems. Recent efforts have demonstrated a strong and unexpected link between quantum computation and artificial neural networks, potentially portending new approaches to machine learning.</p>\n<p>This class of problem can often be cast as optimizations where input into a classical machine learning algorithm comes from a small quantum computation, or where data is represented in the quantum domain and a learning procedure implemented. TensorFlow Quantum provides an exciting toolset for developers seeking new and improved ways to exploit the small quantum computers existing now and in the near future.</p>\n<p>Still, even those small machines don’t perform particularly well. Q-CTRL’s quantum firmware enables users to extract maximum performance from hardware. Thus we see that TensorFlow has a critical role to play across the emerging quantum computing software stack - from quantum firmware through to algorithms for quantum machine learning.</p>\n<p>Resources if you’d like to learn more\nWe appreciate that members of the TensorFlow community may have varying levels of familiarity with quantum computing, and that this overview was only a starting point. To help readers interested in learning more about quantum computing we’re happy to provide a few resources:</p>\n<p>For those knowledgeable about machine learning, Q-CTRL has also produced a series of webinars introducing the concept of Robust Control in quantum computing and even demonstrating reinforcement learning to discover gates on real quantum hardware.\nIf you need to start from zero, Q-CTRL has produced a series of introductory video tutorials helping the uninitiated begin their quantum journey via our learning center. We also offer a visual interface enabling new users to discover and build intuition for the core concepts underlying quantum computing - including the impact of noise on quantum hardware.\nJack Hidary from X wrote a great text focused on linking the foundations of quantum computing with how teams today write code for quantum machines.\nThe traditional “formal” starting point for those interested in quantum computing is the timeless textbook from “Mike and Ike”</p>",
            "url": "https://mayckongiovani.xyz/pensieve/boosting-quantum-computer-hardware",
            "title": "Boosting quantum computer hardware performance with TensorFlow",
            "summary": "Boosting quantum computer hardware performance with TensorFlow",
            "date_modified": "2020-11-03T00:00:00.000Z",
            "tags": [
                "Quantum Computing",
                "TensorFlow"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/simulating-subatomic-physics-on-a-quantum-computer",
            "content_html": "<p>When two heavy ions collide inside a particle accelerator, they produce a near-perfect fluid through which an assortment of fundamental particles swim. For scientists to accurately simulate even a tiny drop of this hot and dense subatomic brew with a classical computer, it would take longer than the age of the universe.</p>\n<p>A collaboration of theorists, experimentalists and computer scientists are exploring how they could crack the mathematics with the help of a powerful and emerging tool: quantum computing.</p>\n<p>“It’s time for us to start thinking about how we can benefit from advances in quantum hardware,” says James Mulligan, a postdoc at the US Department of Energy’s Lawrence Berkeley National Laboratory working on the ALICE Experiment.</p>\n<p>Today, physicists use clusters of high-powered classical computers to crunch numbers and generate simulations of the subatomic world. Classical computers reduce complex information into combinations of ones and zeros called bits. A computer’s hardware processes and encodes these bits by releasing tiny bursts of electrons (for example, a one could be represented by a charge and a zero with no charge). From these simple building blocks, computers can perform incredibly complex calculations, but they require a huge amount of time and resources.</p>\n<p>A quantum computer takes this principle of classical computing and adds a thick layer of nuance.</p>\n<p>“It hinges on the fact that quantum space has properties that classical bits of information do not,” Mulligan says. “A quantum object [such as a particle] can simultaneously be in two states at once, something we call superposition.”</p>\n<p>Quantum computing swaps the deterministic property of “charge vs. no charge” for a quantum property such as an electron’s spin. Spin is an intrinsic characteristic that—when measured—will settle into one of two possible states: ‘spin-up’ or ‘spin-down.’ But because it’s a quantum property, until a measurement is made, the electron’s spin is a superposition of both possibilities.</p>\n<p>“If you think of the electron’s spin like a needle rotating around inside a sphere, it could point in any direction,” says Xiaojun Yao, a postdoc at the Massachusetts Institute of Technology. “When a measurement is made, it will be either spin up or spin down, but what matters is what happens before we do the measurement. We can gain some advantage.”</p>\n<p>Each qubit—that is, the quantum equivalent of a bit—behaves like a microscopic probability spinner that can be tuned and controlled by the computer’s programming. The tuning (which is represented by a complex number) replaces the binary ‘one or zero’ notation of classical bits.</p>\n<p>“In practice, one qubit cannot be more powerful than a classical bit,” Yao says. \"But multiple qubits can be more powerful than multiple classical bits. Theoretically, a small collection of qubits could store a huge amount of information.”</p>\n<p>This switcheroo from binary to non-binary dramatically increases a quantum computer’s ability to perform multifaceted calculations. “It’s exponential,” says Felix Ringer, a postdoc at Berkeley Lab. “A calculation using n number of qubits on a quantum computer would need 2n classical bits on a standard computer.”</p>\n<p>While quantum computers carry little advantage for simple tasks like typing text messages or streaming videos, the implications for certain types of complex calculations are enormous.</p>\n<p>“We can use the quantum processes happening inside a quantum computer to simulate the quantum processes happening inside our experiment,” Ringer says. “Eventually, we could use quantum computers to solve big outstanding problems in our theoretical understanding of the world.”</p>\n<p>Today’s quantum computers are still in their infancy and lack the intricacy and reliability of classical computers. But Mulligan, Yao and Ringer want to be ready when the technology matures.</p>\n<p>Recently, they performed a proof-of-principle study—with funding from DOE’s Office of Science and Berkeley Lab—that examined how the properties of a heavy particle could be impacted after it traversed through a quark-gluon plasma. Quark gluon plasmas are the hottest and densest known state of matter and produced during heavy ion collisions, such as those inside the Relativists Heavy Ion Collider at the DOE’s Brookhaven National Laboratory and the Large Hadron Collider at CERN. The team of scientists ran their simulation on both a real quantum computer built by IBM and on a classical computer configured to imitate a quantum computer.</p>\n<p>“It was slightly more difficult than I expected,” Yao says. “The current quantum machines are noisy, and you have to apply error mitigations to account for the noise and get meaningful results.\"</p>\n<p>After several months of honing their code and testing the outcomes, they were able to demonstrate that these kinds of calculations are already feasible on today’s quantum computers.</p>\n<p>“It’s important to start now and to explore these techniques,” Ringer says. “Potentially, the particle physics community could even have an impact on shaping the evolution of quantum computing by proposing interesting problems that the next generation of machines could solve. There’s many opportunities for collaboration and innovation.”</p>",
            "url": "https://mayckongiovani.xyz/pensieve/simulating-subatomic-physics-on-a-quantum-computer",
            "title": "Simulating subatomic physics on a quantum computer",
            "summary": "How quantum computing could be a game-changer in our understanding of quantum processes.",
            "date_modified": "2020-11-03T00:00:00.000Z",
            "tags": [
                "Quantum Computing"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-11-designing-apis-for-correctness-types-lifetimes-and-capabilit",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Designing APIs for Correctness: Types, Lifetimes, and Capabilities</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming the spec and the code share the same definitions implicitly.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Refinement is a simulation relation between spec and impl:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi></mrow><mo>⊑</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mspace width=\"1em\"></mspace><mo>⇒</mo><mspace width=\"1em\"></mspace><mi mathvariant=\"normal\">∀</mi><mtext>behaviors</mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">m</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">)</mo><mo>⊆</mo><mtext>behaviors</mtext><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">c</mi></mrow><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Impl} \\sqsubseteq \\mathrm{Spec}\\quad\\Rightarrow\\quad \\forall \\text{behaviors}(\\mathrm{Impl}) \\subseteq \\text{behaviors}(\\mathrm{Spec}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Impl</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⊑</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8778em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Spec</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">∀</span><span class=\"mord text\"><span class=\"mord\">behaviors</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">Impl</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⊆</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">behaviors</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">Spec</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<p>Treat counterexamples as regression tests: reduce, encode, and replay.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make the model executable enough to generate counterexamples quickly.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-11-designing-apis-for-correctness-types-lifetimes-and-capabilit",
            "title": "Designing APIs for Correctness: Types, Lifetimes, and Capabilities",
            "summary": "Engineering notebook entry (November 2020): Designing APIs for Correctness: Types, Lifetimes, and Capabilities.",
            "date_modified": "2020-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-10-verified-crypto-interfaces-constant-time-boundaries-and-misu",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Verified Crypto Interfaces: Constant-Time Boundaries and Misuse Resistance</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n<li>Assuming the spec and the code share the same definitions implicitly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-10-verified-crypto-interfaces-constant-time-boundaries-and-misu",
            "title": "Verified Crypto Interfaces: Constant-Time Boundaries and Misuse Resistance",
            "summary": "Adversarial-first deep dive (October 2020): Verified Crypto Interfaces: Constant-Time Boundaries and Misuse Resistance.",
            "date_modified": "2020-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-09-symbolic-execution-when-brute-force-becomes-logic",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Symbolic Execution: When Brute Force Becomes Logic</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating verification as a one-time event rather than a process.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common way to state linearizability is existence of a sequential history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∃</mi><msub><mi>H</mi><mi>s</mi></msub><mo>:</mo><mtext> </mtext><msub><mi>H</mi><mi>s</mi></msub><mtext> is sequential </mtext><mo>∧</mo><msub><mi>H</mi><mi>s</mi></msub><mo>∼</mo><msub><mi>H</mi><mi>c</mi></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\exists H_s:\\ H_s \\text{ is sequential } \\wedge H_s \\sim H_c.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\">∃</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord text\"><span class=\"mord\"> is sequential </span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∼</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">c</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat counterexamples as regression tests: reduce, encode, and replay.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make the model executable enough to generate counterexamples quickly.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-09-symbolic-execution-when-brute-force-becomes-logic",
            "title": "Symbolic Execution: When Brute Force Becomes Logic",
            "summary": "Correctness-focused deep dive (September 2020): Symbolic Execution: When Brute Force Becomes Logic.",
            "date_modified": "2020-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-08-concurrency-testing-in-rust-loom-schedules-and-determinism",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Concurrency Testing in Rust: Loom, Schedules, and Determinism</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you convert counterexamples into test harnesses?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common way to state linearizability is existence of a sequential history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∃</mi><msub><mi>H</mi><mi>s</mi></msub><mo>:</mo><mtext> </mtext><msub><mi>H</mi><mi>s</mi></msub><mtext> is sequential </mtext><mo>∧</mo><msub><mi>H</mi><mi>s</mi></msub><mo>∼</mo><msub><mi>H</mi><mi>c</mi></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\exists H_s:\\ H_s \\text{ is sequential } \\wedge H_s \\sim H_c.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\">∃</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord text\"><span class=\"mord\"> is sequential </span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∼</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">c</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep refinement boundaries explicit: what the spec promises vs what code enforces.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-08-concurrency-testing-in-rust-loom-schedules-and-determinism",
            "title": "Concurrency Testing in Rust: Loom, Schedules, and Determinism",
            "summary": "Adversarial-first deep dive (August 2020): Concurrency Testing in Rust: Loom, Schedules, and Determinism.",
            "date_modified": "2020-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-07-fuzzing-protocol-parsers-when-inputs-are-adversarial",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Fuzzing Protocol Parsers: When Inputs Are Adversarial</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating verification as a one-time event rather than a process.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat counterexamples as regression tests: reduce, encode, and replay.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Workflow:\n1) Write a model with a few state variables.\n2) State invariants (safety) and progress conditions (liveness).\n3) Run model checker with tight bounds.\n4) Minimize counterexamples into test cases.\n5) Iterate until failures are boring.</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-07-fuzzing-protocol-parsers-when-inputs-are-adversarial",
            "title": "Fuzzing Protocol Parsers: When Inputs Are Adversarial",
            "summary": "Threat-model-first analysis (July 2020): Fuzzing Protocol Parsers: When Inputs Are Adversarial.",
            "date_modified": "2020-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-06-differential-testing-using-other-implementations-as-oracles",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Differential Testing: Using Other Implementations as Oracles</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Model the smallest system that can still fail in the way you fear.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n<li>Treating verification as a one-time event rather than a process.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep refinement boundaries explicit: what the spec promises vs what code enforces.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Workflow:\n1) Write a model with a few state variables.\n2) State invariants (safety) and progress conditions (liveness).\n3) Run model checker with tight bounds.\n4) Minimize counterexamples into test cases.\n5) Iterate until failures are boring.</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-06-differential-testing-using-other-implementations-as-oracles",
            "title": "Differential Testing: Using Other Implementations as Oracles",
            "summary": "Spec-driven research note (June 2020): Differential Testing: Using Other Implementations as Oracles.",
            "date_modified": "2020-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-05-property-based-testing-finding-bugs-you-didn-t-imagine",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Property-Based Testing: Finding Bugs You Didn’t Imagine</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming the spec and the code share the same definitions implicitly.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Write properties in plain language next to the formal version.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Workflow:\n1) Write a model with a few state variables.\n2) State invariants (safety) and progress conditions (liveness).\n3) Run model checker with tight bounds.\n4) Minimize counterexamples into test cases.\n5) Iterate until failures are boring.</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-05-property-based-testing-finding-bugs-you-didn-t-imagine",
            "title": "Property-Based Testing: Finding Bugs You Didn’t Imagine",
            "summary": "Threat-model-first analysis (May 2020): Property-Based Testing: Finding Bugs You Didn’t Imagine.",
            "date_modified": "2020-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-04-refinement-proving-your-implementation-matches-the-spec",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Refinement: Proving Your Implementation Matches the Spec</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Keep models small enough to run in seconds or they will rot.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common way to state linearizability is existence of a sequential history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∃</mi><msub><mi>H</mi><mi>s</mi></msub><mo>:</mo><mtext> </mtext><msub><mi>H</mi><mi>s</mi></msub><mtext> is sequential </mtext><mo>∧</mo><msub><mi>H</mi><mi>s</mi></msub><mo>∼</mo><msub><mi>H</mi><mi>c</mi></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\exists H_s:\\ H_s \\text{ is sequential } \\wedge H_s \\sim H_c.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\">∃</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord text\"><span class=\"mord\"> is sequential </span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∼</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">c</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<p>Write properties in plain language next to the formal version.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-04-refinement-proving-your-implementation-matches-the-spec",
            "title": "Refinement: Proving Your Implementation Matches the Spec",
            "summary": "Engineering notebook entry (April 2020): Refinement: Proving Your Implementation Matches the Spec.",
            "date_modified": "2020-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-03-model-checking-at-scale-state-explosion-and-how-to-cheat",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Model Checking at Scale: State Explosion and How to Cheat</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Model the smallest system that can still fail in the way you fear.</li>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Formal models force you to name assumptions (time, ordering, failure).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Writing models that can’t produce counterexamples quickly.</li>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common way to state linearizability is existence of a sequential history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∃</mi><msub><mi>H</mi><mi>s</mi></msub><mo>:</mo><mtext> </mtext><msub><mi>H</mi><mi>s</mi></msub><mtext> is sequential </mtext><mo>∧</mo><msub><mi>H</mi><mi>s</mi></msub><mo>∼</mo><msub><mi>H</mi><mi>c</mi></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\exists H_s:\\ H_s \\text{ is sequential } \\wedge H_s \\sim H_c.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\">∃</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord text\"><span class=\"mord\"> is sequential </span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">s</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">∼</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1514em;\"><span style=\"top:-2.55em;margin-left:-0.0813em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">c</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<p>Write properties in plain language next to the formal version.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-03-model-checking-at-scale-state-explosion-and-how-to-cheat",
            "title": "Model Checking at Scale: State Explosion and How to Cheat",
            "summary": "Adversarial-first deep dive (March 2020): Model Checking at Scale: State Explosion and How to Cheat.",
            "date_modified": "2020-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-02-tla-for-engineers-modeling-the-minimal-thing-that-can-break-",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>TLA+ for Engineers: Modeling the Minimal Thing That Can Break You</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Model the smallest system that can still fail in the way you fear.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>Refinement boundaries prevent “spec drift” between paper and code.</li>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the environment model (adversary actions, scheduling, failures)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>What is the refinement boundary between spec and implementation?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Specifications omit details; implementations invent them. That gap is risk.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n<li>Treating verification as a one-time event rather than a process.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Write properties in plain language next to the formal version.</p>\n<p>Model the scheduler explicitly when concurrency is part of the threat model.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  spec<span class=\"token text string\">[\"Spec (TLA+/PlusCal)\"]</span> <span class=\"token arrow operator\">--></span> mc<span class=\"token text string\">[\"Model Check\"]</span>\n  mc <span class=\"token arrow operator\">--></span> refine<span class=\"token text string\">[\"Refinement / Invariants\"]</span>\n  refine <span class=\"token arrow operator\">--></span> impl<span class=\"token text string\">[\"Implementation (Rust/Go)\"]</span>\n  impl <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Fuzz / PBT / Differential\"]</span>\n  tests <span class=\"token arrow operator\">--></span> spec</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat invariants as code: version, review, and test them.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Practical tip: make the model \"executable\" enough to emit traces you can replay.</span>\n<span class=\"token comment\">// Then treat traces as regression inputs for your implementation.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> bounded versions of the core protocol.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-02-tla-for-engineers-modeling-the-minimal-thing-that-can-break-",
            "title": "TLA+ for Engineers: Modeling the Minimal Thing That Can Break You",
            "summary": "Design memo (February 2020): TLA+ for Engineers: Modeling the Minimal Thing That Can Break You.",
            "date_modified": "2020-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/quantum-computing",
            "content_html": "<p>When was the day that quantum became normalised?\n‘Quantum’, as a modifier within a sentence, has typically denoted something entirely beyond the realm of ordinary comprehension — the demesne of cats at once undead and unliving, of profound theoretical breakthroughs regretted, of keys to new dimensions. Sat on the lip of the 2020s, however, it is both exciting and oddly disconcerting to discover that quantum, such a synonym for the terminally unpredictable, has become a sure shot, an all-but-safe bet.\nOr, at least, quantum computing has. Since the 1990s it has been one of the most anticipated tickmarks on the developmental technological calendar. Now, we are passing between decisive phases in the lifecycle of this unique branch of computing. No longer merely a theoretical preserve, or a lab-bound pursuit, quantum computing is now a major channel of investment for large companies, small companies, VCs, academic institutions, and states. More and more, we are finding applied usage for the prime descendant of the classical computer; to the extent that, come the end of the 20s, quantum computing might be feasibly considered the decade’s definitive technology.\nBut why? And how?\nWhat Are Quantum Computers?\nQuantum computers, and quantum computing, make use of quantum phenomena to execute processes faster. ‘Classical’ computing processes information through regular binaries, often colloquially referred to as ‘0s and 1s’. Quantum principles like superposition (wherein a particle exists in multiple quantum states simultaneously, instead of in one place and state) and entanglement (wherein multiple particles share spatial proximity in such a way as understanding the nature of one divests greater understanding of the other, or others), on the other hand, can be used to allow a computer to process beyond regular binary principles.\nThe basic unit of quantum computing is, therefore, not the bit — a value set to 0 or 1, then arranged into long denotative strings — but the qubit, a value that can be both 0 and 1 simultaneously. Special kinds of atoms that can entertain such two-way states, like “ions, photons, or tiny superconducting circuits”, are therefore the building blocks of quantum computing. The quantum computer reads the degree to which a given qubit is ‘0’ and how much of it is ‘1’. This is often mapped out on a sort of qubit ‘globe’, whereon one point on the globe denotes the quantity of ‘0’ and of ‘1’ that the qubit possesses. To this end, you might more easily think of a value of ‘0’ being represented by the globe’s latitude and a value of ‘1’ by its longitude. Once the ‘coordinates’ of the qubit, and others in the string, have been determined, the computer can proceed with the function denoted.\nOur present computing models were founded on machines essentially designed to make calculus more straightforward — despite our almost deific conception of computing intelligence, the classical computing model is not necessarily as well-optimised for certain among the other tasks we now seek to use it for. As put in a recent report by Morgan Stanley, “While the classical computer is very good at calculus, the quantum computer is even better at sorting, finding prime numbers, simulating molecules, and optimization, and thus could open the door to a new computing era.”\nQuantum computing does not concern one single computing model. There are a variety of viable methods of quantum computing, including via quantum gate array (otherwise known as the quantum circuit), one-way, adiabatic, and topological methods. The adiabatic model is one of the most-implemented at present, and best for solving optimisation problems, though it cannot thoroughly outstrip a classical supercomputer in performance. The gate array model, the other most-implemented model to this point, is more powerful but considerably more difficult and expensive to build.\nJust as there are multiple quantum computing models, there are an array of floated physical realisations of quantum computers. These include the use of superconductors, trapped ions, linear optics, and even the Bose-Einstein condensate we saw be momentously recreated a couple of months back on the ISS.\nBuilding a Qubit\nFor anyone who’s sat with a laptop straining through activity, and burning a hole through their trouser-leg in the process, it may come as a surprise to discover that quantum computers operate at very low temperatures. Colder temperatures, in fact, than can be found in the vacuum of space. Qubits, however powerful, are delicate things, and can be disturbed from their course very easily by any number of complicating elements, heat included.\nIn order to make one of these fine, profound things, you need first an atomic or subatomic substance capable of sustaining a coherent quantum superposition between two states. There are a number of ways of doing so. Cosmos magazine reported that an Australian team led by Michelle Simmons at the University of New South Wales created atomic qubits by placing a single phosphorus atom on a silicon chip, determining the position of the resulting qubit in the crystal lattice from its quantum spin information. You could also run a current through a superconductor, and chart the resultant superposition.\nAn additional means of creating qubits is to dislodge an electron from an atom, thereby making an ion. This ion is then held captive by electromagnetism, and lasers fired at it to provokes changes in quantum state. By such a means, you have a ‘trapped ion’ quantum computer.\nWhy Quantum Computers?\nIt all sounds perfectly impressive, all quite nice — but what takes quantum computing from being blarney-exclusive of the theoretical-scientific community, and into blarney-incipient of the world of applied science, is the vast range of possibilities in use that a quantum computer possesses.\nHaving been freed from the restrictions of binary processing, quantum computers are able to move through operations at an exponentially faster rate than a regular computer, all the while using considerably less energy. This gives quantum computers a tremendous implementation advantage over regular computers — for instance, being able to solve more difficult NP-complete problems in a fraction of the time it would take a classical computer — and that’s before you even get to specific use-cases.\n“The advent proper of quantum computing does not sound the death knell for classical computing.”\nIt should be said — the advent proper of quantum computing does not sound the death knell for classical computing, anymore than the advent of quantum physics rendered all the gains of classical mechanics moot. As in science, quantum computing is merely poised to succeed, and spectacularly so, in the realms where the classical falters. Consumers need not fear a mass-obsolescence of their gear; developers need not be concerned, if any were or continue to be, about the outmoding of their skills. Just as we’ve observed limitations in the powers of classical computers — to optimise, to simulate, to factorise — quantum computers will have weaker areas of their own, including in such everyday tasks as emailing, and the creation and use of documents. Just as a society entirely made up of professionals, and no tradespeople, wouldn’t get very far, the profundity of quantum computing is not the answer to each and every one of our needs and problems.\nIt stands a good chance at solving quite a few of them, however.\nAll Vectors to Brace Position\nQuantum computing has progressed relatively rapidly as a field, beginning ostensibly with Heisenberg’s coining of the Uncertainty Principle in 1927. Its mythological phase was announced via Richard Feynman’s challenge at an IBM/MIT conference in 1981, and the field enjoyed its first practical breakthrough in 1994, when Peter Shor demonstrated that a quantum circuit could factor primes exponentially faster than a classical computer.\nMany years hence, quantum computing is a fixture of interest for large corporations (IBM), specialist start-ups, and, increasingly, the public sector. States are investing billions of dollars in quantum technologies. That’s because, from policy creation to data analysis, and all the way out to some of the most fanciful reaches of experimental physics and chemistry, this new technology will have a pronounced effect.\nChemistry, Cybersecurity &#x26; Search\nYou may already have begun guessing which industry vectors are most likely to be upended by a coming quantum revolution — it’s a good bet to suggest that any industry whose bread and butter is composed of complex logical problems will be among the first and most dramatically affected.\nCybersecurity, for one, will be changed beyond much present recognition by a widespread adoption of quantum computing. There is some thought even now that as a society we are relatively haphazard when it comes to taking steps to secure ourselves online, even aside from those whom do less than is strictly advisable in the cause of this effort. This impression is likely to be compounded by a post-quantum-computing status quo. Rules of encryption will be rewritten overnight. There is no extant factorisation-based cryptographic system that a quantum computer could not break with contemptuous ease. Cryptographic systems will, as a result, presumably get more creative (using more problem- or lattice-based encryption), and we may see a move to more secure quantum-based encrypted systems for storing valuable information and warding against hacking.\nLikewise, any field of technology where optimisation is important will undergo pronounced changes following the adoption of quantum computing. No database is a match for the speed of processing native to a quantum computer. Quantum search, facilitated by quantum algorithms like Grover’s algorithm, allow a more comprehensive return of pertinent results from a database, in fewer queries of that database, than could ever be accomplished by a classical computer. As an unsurprising result, Google has proven one of the keenest parties when it comes to investing in research into the possibilities of quantum computing.\nOf course, quite another set of possibilities in innovation and research will be made possible by quantum computing owing to the fact that, with them in our hands, we will have an authentic environment in which to run quantum simulations. Trying to simulate quantum environments classically is inexact and highly inefficient at best and, as one’s experimental ambitions grow, impossible at the most interesting degrees. Given access to a real quantum computing environment, capable of accurately modelling and simulating quantum conditions, we will see exponential gains made in the kinds of chemistry and nanotechnology which rely on better understandings of quantum mechanics.\nThe Machine Learning Question\nWhenever developments in technology are the subject of discussion, everyone wants to know — “What is this new gear’s effect on machine learning likely to be?” And, if your inquisitor is among the more enthusiastic variety, “Is it likely to destroy us all?”\nWell, machine learning, as conventionally understood, will be introduced to a new era by quantum computing — it is already the subject of major initiatives to demonstrate quantum supremacy[2]. An algorithm for integer factorisation, which is already understood to be a preserve exclusive to quantum computing, will instantly obsole any conventionally held understandings of the limits of the systematic intelligence, even against unintuitive patterns, which can be achieved by a computer.\nThe sheer volume of data which a quantum computer can get through disposes it well to machine learning. Non-supervised learning and reinforcement learning will almost certainly accelerate in development thanks to quantum technologies. As we’ve seen, quantum computers can support considerably more ambitious algorithms than classical computers, which, as a result, are coming near to exhaustion of their possibilities, as far as the interests of certain fields run (including fields “pharmaceutical, life scientific and [financial]”).\nCommunication via the Flaws of Diamonds\nQuantum computing doesn’t begin and end with the quantum ‘desktops’[1] of the future — information networks based on quantum phenomena are high up on the list of desirable outcomes from the next chapters of quantum computational research.\nIn accordance with what we just saw vis-a-vis quantum cryptography, any quantum internet would be considerably faster than the classical kind. It would also be more secure; after all, as this report by Princeton notes, “[a]ny attempt to eavesdrop on[a quantum internet] transmission [by hackers] will perturb its state.” As we noted above, the principles of quantum entanglement are central to the feasibility of a quantum computer and a quantum internet. One qubit being unlawfully observed or disrupted? You’ll have an equivalent ‘twin’ qubit that can tell you all about it. In a quantum network, the state of one qubit will tell you a great deal about others with which it is entangled, no matter the physical distance between them.\n“In a quantum network, the state of one qubit will tell you a great deal about others with which it is entangled, no matter the physical distance between them.”\nOne of the suggested means by which a quantum internet might be built is quite stirring to the imagination. It’s the work of Princeton’s assistant professor of electrical engineering, Nathalie de Leon, who believes that the key to this new kind of informational network is held in the body of diamond. To be more specific, in the flaws of a diamond.\nThe colours we see in the sparkle of a diamond are in fact flaws in the body; but, with a slight modification to their chemical makeup (replacing two carbon atoms with a silicon atom), these regions of flaw are made into perfect photon receptacles. Perfect, in other words, for the transmission of information within a quantum internet. We could in an imaginable future find ourselves communicating on a quantum net, via the flaws of diamonds.\nAside from speed and security, a quantum internet could represent a considerable energy saving, owing to the lower rate of consumption by quantum computers. The Internet at present uses approximately 10% of the world’s total electricity, and more if you factor in the additional energy costs of data centres and the cloud. Not only do single quantum computer units use less energy than their classical counterparts; they have scope for architecture and a cloud system of their own, both of which could represent small but direct reductions of the global-digital carbon footprint.\nQuantum Disruption\nThere is, as we’ve seen, ample disruptive potential in quantum computing as a distinct field of technology — and it seems as though a vast amount of that disruption will be additive and positive, increasing overall knowledge capital and augmenting existing processes and infrastructure instead of sweeping it away.\nIt is harder to imagine any region of scientific and technological inquiry having a higher barrier-to-start-up-entry than quantum computing. Nevertheless, there are a number of promising outfits with quantum computing applications at their core, all of them heavily backed by venture capital.\nRahko\nRahko have set out to go about “solving chemistry with quantum machine learning”. Comprised of a team based in London, Rahko’s quantum machine learning platform is focused on the creation of applied and commercially purposeful insights into quantum chemistry. They raised £1.3M seed from Balderton in their latest funding round.\nQuantifi\nQuantifi, founded in New York, sit at the further frontier of what’s commercially possible with quantum computing solutions, as regards risk and deal analytics.\nCrypto Quantique\nCrypto Quantique are attempting to pre-empt the seismic shifts in crytographic best practices by developing an end-to-end quantum IoT security platform that is, they suggest, all but impregnable.\nFurther Down the Quantum Tunnel\nAs fabulous as many of these applied uses of this fantastic new technology are, I would be remiss were I to suggest that looking further afield, and permitting ourselves some slightly more fanciful speculation about what quantum computing advances will bring, is anything other than the most fun part of any article like this one. What’s more, given quantum computing technology has such a broad church of potential uses, we have even freer license to speculate on things to come in a future full of quantum technology.\nThere are hosts of medical applications for quantum computing. More detailed models of molecular structures will be built; new pharmaceutical products created thereby; and, it’s as likely as not, long-standing illnesses cured at last.\nWe might see erosion-free industrial process; the addition of sufficient mile-range to make electric cars not merely an option, but the option;\nLooking into somewhat darker harbours, there have been suggestions in some quarters that quantum computing might be purposed as a kind of natural enemy of blockchain, though the increase of institutional interest in blockchain, which is rising almost as fast as interest in quantum computing, may put paid to this by itself. Nevertheless, major blockchain initiatives like cryptocurrency could be made extinct through security compromise — in the words of representatives of UK cybersecurity firm Post Quantum, bitcoin is “not quantum computer proof.”\nQuantum computing is also of particular stated interest to military institutions, including the U.S. Airforce. Speaking to SpaceNews, Michael Hayduk, chief of the computing and communications division at the Air Force Research Laboratory approvingly adjudged quantum computing “a very disruptive technology.” Quantum computing could be used to perfect the synchrony of weaponry; as the Chinese example proves, it can also be used to produce unhackable satellites.\nLooking more broadly still, one thing that quantum computing widely adopted does promise is pace. Pace of learning, pace of processing, pace of optimisation — well used, such rapid mastication of such vast troves of data will indubitably lead to greater innovation. Indeed, it would stimulate a race of innovation, one whose dimensions are tailored precisely to the degree of competitive implementations of quantum technologies enacted by rival commercial actors, sector-by-sector.\n“Quantum computing could initiate a different kind of ‘quantum supremacy’, geopolitical in nature, that few nations will wish to be on the receiving end of.”\nAs it is, technological innovation is already proceeding rapidly towards a kind of actuarial escape velocity. As China’s own pace of innovation accelerates in tandem with the global west, even more pressurised incentive is created to continue innovating. Given quantum computing will only accelerate the gains of material science even faster and further, it’s possible that it will create nightmares of scaling, and of the industrial-scale deployment of new technologies.\nThis bottlenecking may, inasmuch, create a huge incentive for greater international collaboration. There is already one mooted and contested notion of quantum supremacy; there might, in the instance of scale-adoption of quantum computing, come the possibility of a more practical quantum supremacy, geopolitical in nature, that few nations will wish to be on the receiving end of.\nThe Trouble with Quanta\nThat’s not to say that quantum computing is a sure-shot for the near future, though it does seem progressively more likely that we’ll see the method graduate from the emergent stage into tackling classically impractical problems — like ultra-rapid integer factorisation, or elite cryptography — in the next decade at least.\nStability\nThere is the potential for instability in quantum processes, as qubits are liable to profound distortion by only minor complications in the context in which they work. The collective attempt to find a panacea for this issue is known as quantum error correction. Decoherence[3] is, understandably, a big problem for particles (or, for that matter, human-sized congregations of particles) that insist on occupying multiple states of being at once. This represents a potential compromise to the utility of even the most powerful of quantum computers.\nOne of the primary means of combatting decoherence, which is to some extent inevitable at some stage of a quantum event, is to have quantum gates faster than decoherence time —and as we observed earlier, quantum gate models are the most demanding and expensive to construct and maintain. Similarly, any functional quantum computer would have to physically scale to accommodate the number of qubits, and furthermore would have to develop a rubric by which qubits could be ‘read’ for the operative functions they denote.\nNot an intrinsic, but an infrastructural ‘drawback’ of quantum computing is the degree of platform transitioning and upgrading it will oblige of service providers across the internet. A company able to develop and scale a solution based on quantum computing — whether in cybersecurity, finance, instance messaging or data science — would rapidly develop an almost unimpeachable advantage over its classical competitors, though doing so would be difficult. The transition would have to be managed and, one would hope, reasonably cooperative. Of course, developed for political ends, a quantum computer that does not have to worry about non-quantum defence mechanisms standing in its way could make for a rather potent weapon.\nIn a Super Position\nThe panorama visible at the vanguard of developments in quantum computing is the kind liable to make your mouth dry. Quantum computers come to us not, in the manner of classical computers, as portals to a strange new world, but rather one which allows us to take our present world in a revised definition.\nOf the manifold issues, sociopolitical and ecological, facing the world at present, some of which can be partially attributable to the principle, as opposed to the fact, of innovation[4], there are two ostensible solutions — to moderate ourselves out of the hole we’ve dug for ourselves, or innovate out of it. The speed, efficiency and cleanliness by which quantum computing is capable of doing its work makes the latter option, by far the most reconcilable to this most sybaritic and consumptive of times, more palatable.\n[1] Many experts find it unlikely that quantum computing will have everyday home uses — your laptop or desktop is unlikely to feature a quantum engine.\n[2] Quantum supremacy can be defined as a kind of proof of a quantum computer’s performance, wherein it completes a function or operation that no classical computer could do, or could do in a feasible amount of time. For quantum researchers, instances of quantum supremacy proven are rather like Pieces of Eight.\n[3] Decoherence is a form of quantum noise, quantum noise itself pertaining to an uncertainty of a physical quantity’s quantum origin and, therefore, its nature. As a discrete kind of quantum noise, decoherence concerns a disrupted wave function — qubits must remain in a consistent wave function (i.e. must remain coherent) in order to be computational intelligible.\n[4] That’s to say — an unduly worshipful approach to innovation-as-end-in-itself, which privileges disruption and excess as proof of concept, instead of innovation considered as a means to a practicable end.</p>",
            "url": "https://mayckongiovani.xyz/pensieve/quantum-computing",
            "title": "Why the 2020s Belong to Quantum Computing",
            "summary": "Why the 2020s Belong to Quantum Computing",
            "date_modified": "2020-01-13T00:00:00.000Z",
            "tags": [
                "Quantum Computing 2020",
                "Science",
                "Technology"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2020-01-safety-liveness-catalog-a-practical-checklist-for-protocol-s",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Formal Methods &#x26; Verification</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Safety/Liveness Catalog: A Practical Checklist for Protocol Specs</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Counterexamples are engineering artifacts—minimize them and turn them into tests.</li>\n<li>Refinement boundaries prevent spec drift between paper and code.</li>\n<li>Write properties in plain language next to the formal statement.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Counterexamples are better than intuition—they are executable bug reports.</li>\n<li>Most catastrophic bugs are small: a missing condition, a stale variable, a rare interleaving.</li>\n<li>Verification complements testing by exploring adversarial schedules systematically.</li>\n<li>The goal is not a perfect proof—it’s reducing the space of unknown failure modes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the smallest model that still captures the bug class you fear?</li>\n<li>How do you ensure proofs stay valid through refactors and upgrades?</li>\n<li>Which properties belong in the model vs in tests vs in monitoring?</li>\n<li>How do you handle state explosion (symmetry, abstraction, bounds)?</li>\n<li>Which invariants must hold under every interleaving and crash point?</li>\n<li>How do you convert counterexamples into test harnesses?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Concurrency introduces interleavings humans don’t reason about reliably.</li>\n<li>Most systems have implicit assumptions about timeouts and ordering.</li>\n<li>Teams need workflows that keep models and code aligned over time.</li>\n<li>Adversaries choose the worst schedule, not the average one.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating verification as a one-time event rather than a process.</li>\n<li>Proving the whole system end-to-end with all implementation details.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>In temporal logic terms, the common shape is:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">f</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">L</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">v</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mo>≡</mo><mi mathvariant=\"normal\">□</mi><mi mathvariant=\"normal\">◊</mi><mtext> </mtext><mrow><mi mathvariant=\"normal\">P</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Safety} \\equiv \\Box\\,\\mathrm{Inv}\\qquad\\qquad\n\\mathrm{Liveness} \\equiv \\Box\\Diamond\\,\\mathrm{Progress}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Safety</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord amsrm\">□</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Liveness</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≡</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8867em;vertical-align:-0.1944em;\"></span><span class=\"mord amsrm\">□◊</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Progress</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat counterexamples as regression tests: reduce, encode, and replay.</p>\n<p>Keep the model small enough to run in seconds; large models rot.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  props<span class=\"token text string\">[\"Properties\"]</span> <span class=\"token arrow operator\">--></span> inv<span class=\"token text string\">[\"Invariants\"]</span>\n  inv <span class=\"token arrow operator\">--></span> model<span class=\"token text string\">[\"Model\"]</span>\n  model <span class=\"token arrow operator\">--></span> cex<span class=\"token text string\">[\"Counterexamples\"]</span>\n  cex <span class=\"token arrow operator\">--></span> tests<span class=\"token text string\">[\"Regression Tests\"]</span>\n  tests <span class=\"token arrow operator\">--></span> model</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Keep refinement boundaries explicit: what the spec promises vs what code enforces.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Workflow:\n1) Write a model with a few state variables.\n2) State invariants (safety) and progress conditions (liveness).\n3) Run model checker with tight bounds.\n4) Minimize counterexamples into test cases.\n5) Iterate until failures are boring.</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Property-based tests</strong> derived from invariants.</li>\n<li><strong>Proof maintenance</strong>: keep models in CI with a time budget.</li>\n<li><strong>Runtime assertions</strong> for invariants that are cheap to check.</li>\n<li><strong>Refinement tests</strong>: compare model traces to implementation traces.</li>\n<li><strong>Differential tests</strong> against other implementations/specs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Run the model checker in CI with explicit timeouts and bounds.</li>\n<li>Treat counterexamples as incidents: track, root-cause, regression-test.</li>\n<li>Version properties and invariants like code; review changes carefully.</li>\n<li>Keep a library of “known hard schedules” from past failures.</li>\n<li>Use models to evaluate protocol upgrades before shipping.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical workflow and examples.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are cheap enough to monitor in production?</li>\n<li>How will you keep models aligned during rapid iteration?</li>\n<li>Which properties are you currently assuming but not testing or proving?</li>\n<li>What is the smallest model that reproduces your worst incident class?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A small protocol that demonstrates why specs matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/tla/book.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Specifying Systems (Lamport)</a> — The TLA+ reference for safety/liveness and system specs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical workflow and examples.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2020-01-safety-liveness-catalog-a-practical-checklist-for-protocol-s",
            "title": "Safety/Liveness Catalog: A Practical Checklist for Protocol Specs",
            "summary": "Adversarial-first deep dive (January 2020): Safety/Liveness Catalog: A Practical Checklist for Protocol Specs.",
            "date_modified": "2020-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "formal-methods",
                "verification",
                "protocol-design",
                "correctness"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-12-validator-ops-key-security-slashing-and-fault-containment",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Validator Ops: Key Security, Slashing, and Fault Containment</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>State commitments bind execution to succinct proofs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>H</mi><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">w</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{root}_{t+1} = H(\\mathrm{root}_t,\\ \\mathrm{block}_t,\\ \\mathrm{witness}_t).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8234em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">block</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">witness</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Determinism is a boundary: every nondeterministic input is an attack surface.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-12-validator-ops-key-security-slashing-and-fault-containment",
            "title": "Validator Ops: Key Security, Slashing, and Fault Containment",
            "summary": "Design memo (December 2019): Validator Ops: Key Security, Slashing, and Fault Containment.",
            "date_modified": "2019-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-11-rust-node-architecture-storage-networking-and-deterministic-",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Rust Node Architecture: Storage, Networking, and Deterministic Execution</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Topology attacks (eclipse, partition) change who sees which transactions.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n<li>Treating mempool policy as “local preference” when it affects security.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A ledger is a replicated state machine. Safety is uniqueness of finalized history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><msub><mi>h</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>h</mi><mn>2</mn></msub><mo>:</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><msub><mi>h</mi><mn>1</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>2</mn></msub><mtext> </mtext><mo>∨</mo><mtext> </mtext><msub><mi>h</mi><mn>2</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>1</mn></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall h_1,h_2:\\ \\mathrm{Final}(h_1)\\wedge \\mathrm{Final}(h_2)\\Rightarrow h_1 \\preceq h_2 \\ \\vee\\ h_2 \\preceq h_1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">∀</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Encode resource accounting and limits early; retrofits are painful.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-11-rust-node-architecture-storage-networking-and-deterministic-",
            "title": "Rust Node Architecture: Storage, Networking, and Deterministic Execution",
            "summary": "Adversarial-first deep dive (November 2019): Rust Node Architecture: Storage, Networking, and Deterministic Execution.",
            "date_modified": "2019-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-10-formalizing-a-blockchain-protocol-properties-worth-proving",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Formalizing a Blockchain Protocol: Properties Worth Proving</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n<li>Topology attacks (eclipse, partition) change who sees which transactions.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A simple resource-admission constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><munder><mo>∑</mo><mrow><mi>t</mi><mi>x</mi><mo>∈</mo><mi>B</mi></mrow></munder><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>t</mi><mi>x</mi><mo stretchy=\"false\">)</mo><mo>≤</mo><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>B</mi><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mtext>(gas/bytes/sigchecks)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\sum_{tx \\in B} \\mathrm{cost}(tx) \\le \\mathrm{budget}(B)\\qquad\\text{(gas/bytes/sigchecks)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:2.3717em;vertical-align:-1.3217em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8557em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mord mathnormal mtight\">x</span><span class=\"mrel mtight\">∈</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05017em;\">B</span></span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.3217em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">cost</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">t</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">budget</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\" style=\"margin-right:0.05017em;\">B</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">(gas/bytes/sigchecks)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> U as User\n  <span class=\"token keyword\">participant</span> N as Node\n  <span class=\"token keyword\">participant</span> P as Peers\n  U<span class=\"token arrow operator\">->></span>N<span class=\"token operator\">:</span> submit<span class=\"token text string\">(tx)</span>\n  N<span class=\"token arrow operator\">->></span>P<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(tx)</span>\n  P<span class=\"token arrow operator\">-->></span>N<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(more tx)</span>\n  <span class=\"token keyword\">Note over</span> N<span class=\"token operator\">:</span> admission + ordering\n  N<span class=\"token arrow operator\">-->></span>U<span class=\"token operator\">:</span> inclusion/finality signal</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat mempool policy as part of the protocol if it changes security outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-10-formalizing-a-blockchain-protocol-properties-worth-proving",
            "title": "Formalizing a Blockchain Protocol: Properties Worth Proving",
            "summary": "Engineering notebook entry (October 2019): Formalizing a Blockchain Protocol: Properties Worth Proving.",
            "date_modified": "2019-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-09-zk-in-protocols-proof-systems-as-network-primitives",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>ZK in Protocols: Proof Systems as Network Primitives</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n<li>Bridges reintroduce trust; you must model it explicitly.</li>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A ledger is a replicated state machine. Safety is uniqueness of finalized history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><msub><mi>h</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>h</mi><mn>2</mn></msub><mo>:</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><msub><mi>h</mi><mn>1</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>2</mn></msub><mtext> </mtext><mo>∨</mo><mtext> </mtext><msub><mi>h</mi><mn>2</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>1</mn></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall h_1,h_2:\\ \\mathrm{Final}(h_1)\\wedge \\mathrm{Final}(h_2)\\Rightarrow h_1 \\preceq h_2 \\ \\vee\\ h_2 \\preceq h_1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">∀</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Encode resource accounting and limits early; retrofits are painful.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-09-zk-in-protocols-proof-systems-as-network-primitives",
            "title": "ZK in Protocols: Proof Systems as Network Primitives",
            "summary": "Spec-driven research note (September 2019): ZK in Protocols: Proof Systems as Network Primitives.",
            "date_modified": "2019-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-08-bridges-where-trust-comes-back-to-collect",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Bridges: Where Trust Comes Back to Collect</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>State commitments bind execution to succinct proofs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>H</mi><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">w</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{root}_{t+1} = H(\\mathrm{root}_t,\\ \\mathrm{block}_t,\\ \\mathrm{witness}_t).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8234em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">block</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">witness</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Separate consensus safety from execution safety; both must hold.</p>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat mempool policy as part of the protocol if it changes security outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Deterministic execution is a security boundary.</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">Executor</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">apply_block</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">mut</span> <span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> block<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">state_root</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">;</span> <span class=\"token number\">32</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Avoid nondeterminism: time, RNG, unordered maps, floating-point.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-08-bridges-where-trust-comes-back-to-collect",
            "title": "Bridges: Where Trust Comes Back to Collect",
            "summary": "Spec-driven research note (August 2019): Bridges: Where Trust Comes Back to Collect.",
            "date_modified": "2019-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-07-fee-markets-and-mev-incentives-as-an-adversary",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Fee Markets and MEV: Incentives as an Adversary</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Bridges reintroduce trust; you must model it explicitly.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A simple resource-admission constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><munder><mo>∑</mo><mrow><mi>t</mi><mi>x</mi><mo>∈</mo><mi>B</mi></mrow></munder><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>t</mi><mi>x</mi><mo stretchy=\"false\">)</mo><mo>≤</mo><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>B</mi><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mtext>(gas/bytes/sigchecks)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\sum_{tx \\in B} \\mathrm{cost}(tx) \\le \\mathrm{budget}(B)\\qquad\\text{(gas/bytes/sigchecks)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:2.3717em;vertical-align:-1.3217em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8557em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mord mathnormal mtight\">x</span><span class=\"mrel mtight\">∈</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05017em;\">B</span></span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.3217em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">cost</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">t</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">budget</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\" style=\"margin-right:0.05017em;\">B</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">(gas/bytes/sigchecks)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat mempool policy as part of the protocol if it changes security outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-07-fee-markets-and-mev-incentives-as-an-adversary",
            "title": "Fee Markets and MEV: Incentives as an Adversary",
            "summary": "Adversarial-first deep dive (July 2019): Fee Markets and MEV: Incentives as an Adversary.",
            "date_modified": "2019-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-06-state-commitments-merkle-verkle-and-proof-sizes",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>State Commitments: Merkle, Verkle, and Proof Sizes</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n<li>Bridges reintroduce trust; you must model it explicitly.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating mempool policy as “local preference” when it affects security.</li>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A simple resource-admission constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><munder><mo>∑</mo><mrow><mi>t</mi><mi>x</mi><mo>∈</mo><mi>B</mi></mrow></munder><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>t</mi><mi>x</mi><mo stretchy=\"false\">)</mo><mo>≤</mo><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>B</mi><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mtext>(gas/bytes/sigchecks)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\sum_{tx \\in B} \\mathrm{cost}(tx) \\le \\mathrm{budget}(B)\\qquad\\text{(gas/bytes/sigchecks)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:2.3717em;vertical-align:-1.3217em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8557em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mord mathnormal mtight\">x</span><span class=\"mrel mtight\">∈</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05017em;\">B</span></span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.3217em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">cost</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">t</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">budget</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\" style=\"margin-right:0.05017em;\">B</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">(gas/bytes/sigchecks)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Separate consensus safety from execution safety; both must hold.</p>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Encode resource accounting and limits early; retrofits are painful.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Deterministic execution is a security boundary.</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">Executor</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">apply_block</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">mut</span> <span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> block<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">state_root</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">;</span> <span class=\"token number\">32</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Avoid nondeterminism: time, RNG, unordered maps, floating-point.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-06-state-commitments-merkle-verkle-and-proof-sizes",
            "title": "State Commitments: Merkle, Verkle, and Proof Sizes",
            "summary": "Correctness-focused deep dive (June 2019): State Commitments: Merkle, Verkle, and Proof Sizes.",
            "date_modified": "2019-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-05-light-clients-trust-minimization-without-full-replication",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Light Clients: Trust Minimization Without Full Replication</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A ledger is a replicated state machine. Safety is uniqueness of finalized history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><msub><mi>h</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>h</mi><mn>2</mn></msub><mo>:</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><msub><mi>h</mi><mn>1</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>2</mn></msub><mtext> </mtext><mo>∨</mo><mtext> </mtext><msub><mi>h</mi><mn>2</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>1</mn></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall h_1,h_2:\\ \\mathrm{Final}(h_1)\\wedge \\mathrm{Final}(h_2)\\Rightarrow h_1 \\preceq h_2 \\ \\vee\\ h_2 \\preceq h_1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">∀</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Determinism is a boundary: every nondeterministic input is an attack surface.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Deterministic execution is a security boundary.</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">Executor</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">apply_block</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">mut</span> <span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> block<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">state_root</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">;</span> <span class=\"token number\">32</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Avoid nondeterminism: time, RNG, unordered maps, floating-point.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-05-light-clients-trust-minimization-without-full-replication",
            "title": "Light Clients: Trust Minimization Without Full Replication",
            "summary": "Threat-model-first analysis (May 2019): Light Clients: Trust Minimization Without Full Replication.",
            "date_modified": "2019-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-04-finality-and-reorgs-what-users-think-vs-what-protocols-provi",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Finality and Reorgs: What Users Think vs What Protocols Provide</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Bridges reintroduce trust; you must model it explicitly.</li>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A ledger is a replicated state machine. Safety is uniqueness of finalized history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><msub><mi>h</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>h</mi><mn>2</mn></msub><mo>:</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><msub><mi>h</mi><mn>1</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>2</mn></msub><mtext> </mtext><mo>∨</mo><mtext> </mtext><msub><mi>h</mi><mn>2</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>1</mn></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall h_1,h_2:\\ \\mathrm{Final}(h_1)\\wedge \\mathrm{Final}(h_2)\\Rightarrow h_1 \\preceq h_2 \\ \\vee\\ h_2 \\preceq h_1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">∀</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Model the mempool as an adversarial scheduler: it chooses which work gets executed.</p>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> U as User\n  <span class=\"token keyword\">participant</span> N as Node\n  <span class=\"token keyword\">participant</span> P as Peers\n  U<span class=\"token arrow operator\">->></span>N<span class=\"token operator\">:</span> submit<span class=\"token text string\">(tx)</span>\n  N<span class=\"token arrow operator\">->></span>P<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(tx)</span>\n  P<span class=\"token arrow operator\">-->></span>N<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(more tx)</span>\n  <span class=\"token keyword\">Note over</span> N<span class=\"token operator\">:</span> admission + ordering\n  N<span class=\"token arrow operator\">-->></span>U<span class=\"token operator\">:</span> inclusion/finality signal</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Encode resource accounting and limits early; retrofits are painful.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-04-finality-and-reorgs-what-users-think-vs-what-protocols-provi",
            "title": "Finality and Reorgs: What Users Think vs What Protocols Provide",
            "summary": "Engineering notebook entry (April 2019): Finality and Reorgs: What Users Think vs What Protocols Provide.",
            "date_modified": "2019-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-03-gossip-networks-propagation-eclipse-attacks-and-topology",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Gossip Networks: Propagation, Eclipse Attacks, and Topology</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Upgrades must be compatibility-aware: mixed rulesets are a threat model.</li>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Topology attacks (eclipse, partition) change who sees which transactions.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on client-side heuristics to paper over protocol ambiguity.</li>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A simple resource-admission constraint:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><munder><mo>∑</mo><mrow><mi>t</mi><mi>x</mi><mo>∈</mo><mi>B</mi></mrow></munder><mrow><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>t</mi><mi>x</mi><mo stretchy=\"false\">)</mo><mo>≤</mo><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">u</mi><mi mathvariant=\"normal\">d</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">t</mi></mrow><mo stretchy=\"false\">(</mo><mi>B</mi><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mtext>(gas/bytes/sigchecks)</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\sum_{tx \\in B} \\mathrm{cost}(tx) \\le \\mathrm{budget}(B)\\qquad\\text{(gas/bytes/sigchecks)}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:2.3717em;vertical-align:-1.3217em;\"></span><span class=\"mop op-limits\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.05em;\"><span style=\"top:-1.8557em;margin-left:0em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mord mathnormal mtight\">x</span><span class=\"mrel mtight\">∈</span><span class=\"mord mathnormal mtight\" style=\"margin-right:0.05017em;\">B</span></span></span></span><span style=\"top:-3.05em;\"><span class=\"pstrut\" style=\"height:3.05em;\"></span><span><span class=\"mop op-symbol large-op\">∑</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.3217em;\"><span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">cost</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">t</span><span class=\"mord mathnormal\">x</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≤</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">budget</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\" style=\"margin-right:0.05017em;\">B</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">(gas/bytes/sigchecks)</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<p>Separate consensus safety from execution safety; both must hold.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> U as User\n  <span class=\"token keyword\">participant</span> N as Node\n  <span class=\"token keyword\">participant</span> P as Peers\n  U<span class=\"token arrow operator\">->></span>N<span class=\"token operator\">:</span> submit<span class=\"token text string\">(tx)</span>\n  N<span class=\"token arrow operator\">->></span>P<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(tx)</span>\n  P<span class=\"token arrow operator\">-->></span>N<span class=\"token operator\">:</span> gossip<span class=\"token text string\">(more tx)</span>\n  <span class=\"token keyword\">Note over</span> N<span class=\"token operator\">:</span> admission + ordering\n  N<span class=\"token arrow operator\">-->></span>U<span class=\"token operator\">:</span> inclusion/finality signal</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Determinism is a boundary: every nondeterministic input is an attack surface.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Deterministic execution is a security boundary.</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">Executor</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">apply_block</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">mut</span> <span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> block<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">state_root</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">;</span> <span class=\"token number\">32</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Avoid nondeterminism: time, RNG, unordered maps, floating-point.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-03-gossip-networks-propagation-eclipse-attacks-and-topology",
            "title": "Gossip Networks: Propagation, Eclipse Attacks, and Topology",
            "summary": "Adversarial-first deep dive (March 2019): Gossip Networks: Propagation, Eclipse Attacks, and Topology.",
            "date_modified": "2019-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-02-mempool-design-under-adversarial-load-admission-fees-and-spa",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Mempool Design Under Adversarial Load: Admission, Fees, and Spam</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Consensus safety is meaningless if execution is nondeterministic across nodes.</li>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n<li>State growth is a security problem: it impacts decentralization and verification.</li>\n<li>Mempools are an attack surface: spam, pinning, and incentive manipulation.</li>\n<li>MEV turns protocol details into adversarial strategy.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do upgrades change security assumptions (fork choice, state transition rules)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n<li>Where do you enforce resource limits (gas, bandwidth, storage, signature checks)?</li>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Upgrades happen under partial adoption; mixed-version is inevitable.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming honest majority without defining the adversary’s budget.</li>\n<li>Treating mempool policy as “local preference” when it affects security.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>State commitments bind execution to succinct proofs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>H</mi><mo stretchy=\"false\">(</mo><msub><mrow><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">t</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">b</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">c</mi><mi mathvariant=\"normal\">k</mi></mrow><mi>t</mi></msub><mo separator=\"true\">,</mo><mtext> </mtext><msub><mrow><mi mathvariant=\"normal\">w</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">s</mi></mrow><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{root}_{t+1} = H(\\mathrm{root}_t,\\ \\mathrm{block}_t,\\ \\mathrm{witness}_t).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8234em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.08125em;\">H</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">root</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">block</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">witness</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Separate consensus safety from execution safety; both must hold.</p>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat mempool policy as part of the protocol if it changes security outcomes.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Mempool hardening checklist:\n- Per-peer rate limits + global admission budget\n- Duplicate detection and eviction policy\n- Signature verification batching with caps\n- Anti-DoS: bounded decode/parse cost\n- Fairness: per-sender quotas (avoid hot-account starvation)</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Cross-implementation tests</strong> when multiple clients exist.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Keep execution resource limits explicit and enforced.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-02-mempool-design-under-adversarial-load-admission-fees-and-spa",
            "title": "Mempool Design Under Adversarial Load: Admission, Fees, and Spam",
            "summary": "Adversarial-first deep dive (February 2019): Mempool Design Under Adversarial Load: Admission, Fees, and Spam.",
            "date_modified": "2019-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2019-01-the-ledger-as-a-state-machine-execution-determinism-and-repr",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Blockchain Protocols</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>The Ledger as a State Machine: Execution, Determinism, and Reproducibility</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Finality guarantees are user security guarantees—document and enforce them.</li>\n<li>Topology attacks (eclipse/partition) change security outcomes; harden peer selection.</li>\n<li>Mempools are adversarial schedulers: admission and fairness are protocol concerns.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Bridges reintroduce trust; you must model it explicitly.</li>\n<li>Topology attacks (eclipse, partition) change who sees which transactions.</li>\n<li>Light clients shift assumptions; they must be written down.</li>\n<li>Finality guarantees are user security guarantees; ambiguity is a UX vulnerability.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which invariants need proofs (supply, balances, ordering, slashing)?</li>\n<li>Where is the economic/DoS pressure applied (mempool, gossip, execution, storage)?</li>\n<li>What is the determinism story (byte-for-byte re-execution across platforms)?</li>\n<li>What is the finality guarantee users can rely on (and when does it break)?</li>\n<li>How do you defend against topology attacks (eclipse, partition, sybil)?</li>\n<li>What is the reorg budget for applications and how do you communicate it?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Users and apps rely on probabilistic finality until proven otherwise.</li>\n<li>Attackers can buy bandwidth and compute; they can also bribe and censor.</li>\n<li>Nodes are heterogeneous; determinism must survive platform differences.</li>\n<li>Peers are untrusted; gossip can be manipulated for delay or isolation.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Allowing execution nondeterminism for performance convenience.</li>\n<li>Treating mempool policy as “local preference” when it affects security.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A ledger is a replicated state machine. Safety is uniqueness of finalized history:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><msub><mi>h</mi><mn>1</mn></msub><mo separator=\"true\">,</mo><msub><mi>h</mi><mn>2</mn></msub><mo>:</mo><mtext> </mtext><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo>∧</mo><mrow><mi mathvariant=\"normal\">F</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">l</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>h</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><msub><mi>h</mi><mn>1</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>2</mn></msub><mtext> </mtext><mo>∨</mo><mtext> </mtext><msub><mi>h</mi><mn>2</mn></msub><mo>⪯</mo><msub><mi>h</mi><mn>1</mn></msub><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall h_1,h_2:\\ \\mathrm{Final}(h_1)\\wedge \\mathrm{Final}(h_2)\\Rightarrow h_1 \\preceq h_2 \\ \\vee\\ h_2 \\preceq h_1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">∀</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">Final</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∨</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⪯</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">h</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Explicitly model upgrade boundaries: old rules vs new rules during transition.</p>\n<p>Treat reorgs as a user-visible security event; encode reorg-aware semantics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  tx<span class=\"token text string\">[\"Transaction\"]</span> <span class=\"token arrow operator\">--></span> mp<span class=\"token text string\">[\"Mempool (admission + prioritization)\"]</span>\n  mp <span class=\"token arrow operator\">--></span> prop<span class=\"token text string\">[\"Block Proposal\"]</span>\n  prop <span class=\"token arrow operator\">--></span> cons<span class=\"token text string\">[\"Consensus / Finality\"]</span>\n  cons <span class=\"token arrow operator\">--></span> exec<span class=\"token text string\">[\"Deterministic Execution\"]</span>\n  exec <span class=\"token arrow operator\">--></span> root<span class=\"token text string\">[\"State Root Commitment\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Determinism is a boundary: every nondeterministic input is an attack surface.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token comment\">// Deterministic execution is a security boundary.</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">Executor</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">apply_block</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">mut</span> <span class=\"token keyword\">self</span><span class=\"token punctuation\">,</span> block<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">String</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">state_root</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token keyword\">self</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token punctuation\">[</span><span class=\"token keyword\">u8</span><span class=\"token punctuation\">;</span> <span class=\"token number\">32</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Avoid nondeterminism: time, RNG, unordered maps, floating-point.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fuzzing</strong> transaction decoding and state transition edge cases.</li>\n<li><strong>Adversarial mempool tests</strong>: spam, pinning, worst-case signature patterns.</li>\n<li><strong>Determinism tests</strong> across architectures (x86/ARM) and OSes.</li>\n<li><strong>Formal invariants</strong> for supply/balance conservation where appropriate.</li>\n<li><strong>Fork/reorg simulations</strong>: application-facing invariants under reorgs.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Keep execution resource limits explicit and enforced.</li>\n<li>Protect peer tables against eclipse attempts (diversity, scoring, rotation).</li>\n<li>Measure invalid tx rejection reasons and rates (spam signature).</li>\n<li>Rehearse upgrades with mixed versions and rollback paths.</li>\n<li>Monitor reorg depth and frequency; treat increases as incidents.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you communicate finality uncertainty to users without lying?</li>\n<li>Where does your implementation accidentally depend on local wall-clock time?</li>\n<li>What is the worst-case work a single transaction can force?</li>\n<li>Which invariants should be proven vs tested vs monitored?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://bitcoin.org/bitcoin.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bitcoin: A Peer-to-Peer Electronic Cash System</a> — The original replicated-ledger model and threat assumptions.</li>\n<li><a href=\"https://ethereum.github.io/yellowpaper/paper.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Ethereum Yellow Paper</a> — A formal-ish specification for execution and state transitions.</li>\n<li><a href=\"https://eips.ethereum.org/EIPS/eip-1559\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">EIP-1559</a> — Fee market mechanics and incentive surfaces.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2019-01-the-ledger-as-a-state-machine-execution-determinism-and-repr",
            "title": "The Ledger as a State Machine: Execution, Determinism, and Reproducibility",
            "summary": "Adversarial-first deep dive (January 2019): The Ledger as a State Machine: Execution, Determinism, and Reproducibility.",
            "date_modified": "2019-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "blockchain-protocols",
                "distributed-systems",
                "cryptography",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-12-incident-response-for-crypto-systems-key-compromise-playbook",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Incident Response for Crypto Systems: Key Compromise Playbooks</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Bind purpose and context (domain separation) so keys can’t be misused accidentally.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n<li>Key management failures are systemic: the breach is “a workflow,” not a bug.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do you handle key erasure and “right to be forgotten” constraints?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Passing raw private keys across process boundaries.</li>\n<li>Assuming “HSM = secure” without defining the threat model.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Audit integrity is a cryptographic property:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>audit</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>event</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{log\\_entry} \\leftarrow \\mathrm{Sign}_{k_\\text{audit}}(\\mathrm{hash}(\\text{event})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">log_entry</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">audit</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">event</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Never pass secrets around; pass handles with purpose constraints.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--2\">(<a href=\"#bib-rfc8446\">2</a>)</span> — Modern handshake design, key schedule, and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-12-incident-response-for-crypto-systems-key-compromise-playbook",
            "title": "Incident Response for Crypto Systems: Key Compromise Playbooks",
            "summary": "Correctness-focused deep dive (December 2018): Incident Response for Crypto Systems: Key Compromise Playbooks.",
            "date_modified": "2018-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-11-kms-hsm-threat-models-when-managed-doesnt-mean-safe",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>KMS/HSM Threat Models: When 'Managed' Doesn't Mean 'Safe'</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Bind purpose and context (domain separation) so keys can’t be misused accidentally.</li>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Auditability must not become a secret-leaking logging pipeline.</li>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>How do you handle key erasure and “right to be forgotten” constraints?</li>\n<li>Which operations must be constant-time and how do you validate that?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Rotation must occur under incident pressure; automation must be safe.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on manual rotation procedures for fleet-scale systems.</li>\n<li>Passing raw private keys across process boundaries.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Audit integrity is a cryptographic property:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>audit</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>event</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{log\\_entry} \\leftarrow \\mathrm{Sign}_{k_\\text{audit}}(\\mathrm{hash}(\\text{event})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">log_entry</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">audit</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">event</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make policy explicit and enforce it in the narrowest component possible.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--2\">(<a href=\"#bib-rfc5869\">2</a>)</span> — Domain separation and key derivation done sanely.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-11-kms-hsm-threat-models-when-managed-doesnt-mean-safe",
            "title": "KMS/HSM Threat Models: When 'Managed' Doesn't Mean 'Safe'",
            "summary": "Correctness-focused deep dive (November 2018): KMS/HSM Threat Models: When 'Managed' Doesn't Mean 'Safe'.",
            "date_modified": "2018-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-10-multi-tenant-isolation-crypto-boundaries-vs-kernel-boundarie",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Multi-Tenant Isolation: Crypto Boundaries vs Kernel Boundaries</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Key management failures are systemic: the breach is “a workflow,” not a bug.</li>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>Which operations must be constant-time and how do you validate that?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Passing raw private keys across process boundaries.</li>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A practical safety statement for key usage is least authority:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>capability</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> purpose</mtext><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">¬</mi><mtext>use</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> other purpose</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{capability}(\\text{key},\\ \\text{purpose}) \\Rightarrow \\neg \\text{use}(\\text{key},\\ \\text{other purpose}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">capability</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">purpose</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">¬</span><span class=\"mord text\"><span class=\"mord\">use</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">other purpose</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make policy explicit and enforce it in the narrowest component possible.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Capability-style API: callers get a handle scoped to purpose + TTL.</span>\n<span class=\"token keyword\">type</span> KeyPurpose <span class=\"token builtin\">string</span>\n<span class=\"token keyword\">type</span> KeyHandle <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  ID <span class=\"token builtin\">string</span>\n  Purpose KeyPurpose\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">type</span> Signer <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Sign</span><span class=\"token punctuation\">(</span>h KeyHandle<span class=\"token punctuation\">,</span> msg <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>sig <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-10-multi-tenant-isolation-crypto-boundaries-vs-kernel-boundarie",
            "title": "Multi-Tenant Isolation: Crypto Boundaries vs Kernel Boundaries",
            "summary": "Spec-driven research note (October 2018): Multi-Tenant Isolation: Crypto Boundaries vs Kernel Boundaries.",
            "date_modified": "2018-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-09-cryptographic-agility-designing-for-the-algorithm-you-havent",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Cryptographic Agility: Designing for the Algorithm You Haven't Met Yet</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Policy drift silently turns strong crypto into weak practice.</li>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>How do you handle key erasure and “right to be forgotten” constraints?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Passing raw private keys across process boundaries.</li>\n<li>Relying on manual rotation procedures for fleet-scale systems.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Key derivation is where protocols quietly succeed or fail. A sane default is domain-separated HKDF:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>k</mi><mo>←</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><mtext>salt</mtext><mo separator=\"true\">,</mo><mtext> ikm</mtext><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mtext>context</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">k \\leftarrow \\mathrm{HKDF}(\\text{salt},\\ \\text{ikm},\\ \\text{info}=\\text{context}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">salt</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">ikm</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">context</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  policy<span class=\"token text string\">[\"Policy (purpose + TTL)\"]</span> <span class=\"token arrow operator\">--></span> service<span class=\"token text string\">[\"Signer Service\"]</span>\n  service <span class=\"token arrow operator\">--></span> hsm<span class=\"token text string\">[\"HSM/KMS\"]</span>\n  service <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit Stream\"]</span>\n  audit <span class=\"token arrow operator\">--></span> siem<span class=\"token text string\">[\"Detection/Response\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Never pass secrets around; pass handles with purpose constraints.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Capability-style API: callers get a handle scoped to purpose + TTL.</span>\n<span class=\"token keyword\">type</span> KeyPurpose <span class=\"token builtin\">string</span>\n<span class=\"token keyword\">type</span> KeyHandle <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  ID <span class=\"token builtin\">string</span>\n  Purpose KeyPurpose\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">type</span> Signer <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Sign</span><span class=\"token punctuation\">(</span>h KeyHandle<span class=\"token punctuation\">,</span> msg <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>sig <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Domain separation and key derivation done sanely.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-09-cryptographic-agility-designing-for-the-algorithm-you-havent",
            "title": "Cryptographic Agility: Designing for the Algorithm You Haven't Met Yet",
            "summary": "Threat-model-first analysis (September 2018): Cryptographic Agility: Designing for the Algorithm You Haven't Met Yet.",
            "date_modified": "2018-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-08-logging-for-forensics-tamper-evident-event-pipelines",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Logging for Forensics: Tamper Evident Event Pipelines</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming “HSM = secure” without defining the threat model.</li>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A practical safety statement for key usage is least authority:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>capability</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> purpose</mtext><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">¬</mi><mtext>use</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> other purpose</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{capability}(\\text{key},\\ \\text{purpose}) \\Rightarrow \\neg \\text{use}(\\text{key},\\ \\text{other purpose}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">capability</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">purpose</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">¬</span><span class=\"mord text\"><span class=\"mord\">use</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">other purpose</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  policy<span class=\"token text string\">[\"Policy (purpose + TTL)\"]</span> <span class=\"token arrow operator\">--></span> service<span class=\"token text string\">[\"Signer Service\"]</span>\n  service <span class=\"token arrow operator\">--></span> hsm<span class=\"token text string\">[\"HSM/KMS\"]</span>\n  service <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit Stream\"]</span>\n  audit <span class=\"token arrow operator\">--></span> siem<span class=\"token text string\">[\"Detection/Response\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Never pass secrets around; pass handles with purpose constraints.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-08-logging-for-forensics-tamper-evident-event-pipelines",
            "title": "Logging for Forensics: Tamper Evident Event Pipelines",
            "summary": "Adversarial-first deep dive (August 2018): Logging for Forensics: Tamper Evident Event Pipelines.",
            "date_modified": "2018-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-07-tls-beyond-defaults-ciphersuites-alpn-and-operational-realit",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>TLS Beyond Defaults: Ciphersuites, ALPN, and Operational Reality</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Bind purpose and context (domain separation) so keys can’t be misused accidentally.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n<li>Key management failures are systemic: the breach is “a workflow,” not a bug.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which operations must be constant-time and how do you validate that?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Rotation must occur under incident pressure; automation must be safe.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n<li>Assuming “HSM = secure” without defining the threat model.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A practical safety statement for key usage is least authority:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>capability</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> purpose</mtext><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">¬</mi><mtext>use</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> other purpose</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{capability}(\\text{key},\\ \\text{purpose}) \\Rightarrow \\neg \\text{use}(\\text{key},\\ \\text{other purpose}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">capability</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">purpose</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">¬</span><span class=\"mord text\"><span class=\"mord\">use</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">other purpose</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Never pass secrets around; pass handles with purpose constraints.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Separate duties and restrict production key access paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--1\">(<a href=\"#bib-rfc8446\">1</a>)</span> — Modern handshake design, key schedule, and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-07-tls-beyond-defaults-ciphersuites-alpn-and-operational-realit",
            "title": "TLS Beyond Defaults: Ciphersuites, ALPN, and Operational Reality",
            "summary": "Spec-driven research note (July 2018): TLS Beyond Defaults: Ciphersuites, ALPN, and Operational Reality.",
            "date_modified": "2018-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-06-secure-firmware-updates-signed-manifests-and-rollback-protec",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secure Firmware Updates: Signed Manifests and Rollback Protection</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Side channels turn performance details into security boundaries.</li>\n<li>Policy drift silently turns strong crypto into weak practice.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>Which operations must be constant-time and how do you validate that?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n<li>Passing raw private keys across process boundaries.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Audit integrity is a cryptographic property:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>audit</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>event</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{log\\_entry} \\leftarrow \\mathrm{Sign}_{k_\\text{audit}}(\\mathrm{hash}(\\text{event})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">log_entry</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">audit</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">event</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Crypto infra is a product: UX, policy, audit, and rollback must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--1\">(<a href=\"#bib-rfc8446\">1</a>)</span> — Modern handshake design, key schedule, and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Real-world PKI incidents and operational lessons.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-06-secure-firmware-updates-signed-manifests-and-rollback-protec",
            "title": "Secure Firmware Updates: Signed Manifests and Rollback Protection",
            "summary": "Spec-driven research note (June 2018): Secure Firmware Updates: Signed Manifests and Rollback Protection.",
            "date_modified": "2018-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-05-side-channels-constant-time-cache-attacks-and-real-threat-mo",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Side Channels: Constant-Time, Cache Attacks, and Real Threat Models</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Key management failures are systemic: the breach is “a workflow,” not a bug.</li>\n<li>Policy drift silently turns strong crypto into weak practice.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n<li>Relying on manual rotation procedures for fleet-scale systems.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Key derivation is where protocols quietly succeed or fail. A sane default is domain-separated HKDF:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>k</mi><mo>←</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><mtext>salt</mtext><mo separator=\"true\">,</mo><mtext> ikm</mtext><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mtext>context</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">k \\leftarrow \\mathrm{HKDF}(\\text{salt},\\ \\text{ikm},\\ \\text{info}=\\text{context}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">salt</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">ikm</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">context</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  policy<span class=\"token text string\">[\"Policy (purpose + TTL)\"]</span> <span class=\"token arrow operator\">--></span> service<span class=\"token text string\">[\"Signer Service\"]</span>\n  service <span class=\"token arrow operator\">--></span> hsm<span class=\"token text string\">[\"HSM/KMS\"]</span>\n  service <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit Stream\"]</span>\n  audit <span class=\"token arrow operator\">--></span> siem<span class=\"token text string\">[\"Detection/Response\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Crypto infra is a product: UX, policy, audit, and rollback must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-05-side-channels-constant-time-cache-attacks-and-real-threat-mo",
            "title": "Side Channels: Constant-Time, Cache Attacks, and Real Threat Models",
            "summary": "Adversarial-first deep dive (May 2018): Side Channels: Constant-Time, Cache Attacks, and Real Threat Models.",
            "date_modified": "2018-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-04-hardware-roots-of-trust-tpm-secure-boot-and-attestation",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Hardware Roots of Trust: TPM, Secure Boot, and Attestation</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n<li>Auditability must not become a secret-leaking logging pipeline.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>How do you handle key erasure and “right to be forgotten” constraints?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Rotation must occur under incident pressure; automation must be safe.</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Passing raw private keys across process boundaries.</li>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Key derivation is where protocols quietly succeed or fail. A sane default is domain-separated HKDF:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>k</mi><mo>←</mo><mrow><mi mathvariant=\"normal\">H</mi><mi mathvariant=\"normal\">K</mi><mi mathvariant=\"normal\">D</mi><mi mathvariant=\"normal\">F</mi></mrow><mo stretchy=\"false\">(</mo><mtext>salt</mtext><mo separator=\"true\">,</mo><mtext> ikm</mtext><mo separator=\"true\">,</mo><mtext> info</mtext><mo>=</mo><mtext>context</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">k \\leftarrow \\mathrm{HKDF}(\\text{salt},\\ \\text{ikm},\\ \\text{info}=\\text{context}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\">HKDF</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">salt</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">ikm</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">info</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">context</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Crypto infra is a product: UX, policy, audit, and rollback must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Capability-style API: callers get a handle scoped to purpose + TTL.</span>\n<span class=\"token keyword\">type</span> KeyPurpose <span class=\"token builtin\">string</span>\n<span class=\"token keyword\">type</span> KeyHandle <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  ID <span class=\"token builtin\">string</span>\n  Purpose KeyPurpose\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">type</span> Signer <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Sign</span><span class=\"token punctuation\">(</span>h KeyHandle<span class=\"token punctuation\">,</span> msg <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>sig <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> <span class=\"citation\" id=\"citation--rfc5869--1\">(<a href=\"#bib-rfc5869\">1</a>)</span> — Domain separation and key derivation done sanely.\n<ul>\n<li><strong>Evidence:</strong> HKDF is the workhorse for domain separation; bind purpose/context to avoid cross-protocol key reuse.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc5869\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Krawczyk H, Eronen P. HMAC-based Extract-and-Expand Key Derivation Function (HKDF) [Internet]. RFC Editor; 2010. Report No.: 5869. Available from: https://www.rfc-editor.org/rfc/rfc5869</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-04-hardware-roots-of-trust-tpm-secure-boot-and-attestation",
            "title": "Hardware Roots of Trust: TPM, Secure Boot, and Attestation",
            "summary": "Correctness-focused deep dive (April 2018): Hardware Roots of Trust: TPM, Secure Boot, and Attestation.",
            "date_modified": "2018-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-03-secrets-vs-capabilities-token-design-in-microservices",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Secrets vs Capabilities: Token Design in Microservices</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Audit logs are evidence: make them tamper-evident and queryable during incidents.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Auditability must not become a secret-leaking logging pipeline.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do keys rotate safely (overlap windows, dual-sign, staged rollout)?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>How do you handle key erasure and “right to be forgotten” constraints?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n<li>Relying on manual rotation procedures for fleet-scale systems.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A practical safety statement for key usage is least authority:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>capability</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> purpose</mtext><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">¬</mi><mtext>use</mtext><mo stretchy=\"false\">(</mo><mtext>key</mtext><mo separator=\"true\">,</mo><mtext> other purpose</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\text{capability}(\\text{key},\\ \\text{purpose}) \\Rightarrow \\neg \\text{use}(\\text{key},\\ \\text{other purpose}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">capability</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">purpose</span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">¬</span><span class=\"mord text\"><span class=\"mord\">use</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">key</span></span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">other purpose</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<p>Bind every derived key to context: protocol, role, version, and transcript.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Crypto infra is a product: UX, policy, audit, and rollback must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Capability-style API: callers get a handle scoped to purpose + TTL.</span>\n<span class=\"token keyword\">type</span> KeyPurpose <span class=\"token builtin\">string</span>\n<span class=\"token keyword\">type</span> KeyHandle <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  ID <span class=\"token builtin\">string</span>\n  Purpose KeyPurpose\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">type</span> Signer <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Sign</span><span class=\"token punctuation\">(</span>h KeyHandle<span class=\"token punctuation\">,</span> msg <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>sig <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Separate duties and restrict production key access paths.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--1\">(<a href=\"#bib-letsencryptincidents\">1</a>)</span> — Real-world PKI incidents and operational lessons.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> <span class=\"citation\" id=\"citation--rfc8446--2\">(<a href=\"#bib-rfc8446\">2</a>)</span> — Modern handshake design, key schedule, and downgrade resistance patterns.\n<ul>\n<li><strong>Evidence:</strong> Handshake transcript binding and downgrade resistance patterns; monitor negotiation paths and failure reasons.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc8446\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Rescorla E. The Transport Layer Security (TLS) Protocol Version 1.3 [Internet]. RFC Editor; 2018. Report No.: 8446. Available from: https://www.rfc-editor.org/rfc/rfc8446</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-03-secrets-vs-capabilities-token-design-in-microservices",
            "title": "Secrets vs Capabilities: Token Design in Microservices",
            "summary": "Design memo (March 2018): Secrets vs Capabilities: Token Design in Microservices.",
            "date_modified": "2018-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-02-key-management-at-scale-rotation-audit-and-blast-radius",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Key Management at Scale: Rotation, Audit, and Blast Radius</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Rotation and rollback are core features—design them before you ship.</li>\n<li>Bind purpose and context (domain separation) so keys can’t be misused accidentally.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational reality (rotation, audit, rollback) is where crypto systems fail.</li>\n<li>Cryptographic agility is useless if rollout and rollback are unsafe.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>Which operations must be constant-time and how do you validate that?</li>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Attackers can observe timing and resource usage in shared environments.</li>\n<li>Certificate chains and policies evolve; clients won’t all update together.</li>\n<li>Rotation must occur under incident pressure; automation must be safe.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming “HSM = secure” without defining the threat model.</li>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Audit integrity is a cryptographic property:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>audit</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>event</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{log\\_entry} \\leftarrow \\mathrm{Sign}_{k_\\text{audit}}(\\mathrm{hash}(\\text{event})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">log_entry</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">audit</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">event</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat key identifiers as capabilities with purpose constraints—enforce in code and policy.</p>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> LR\n  policy<span class=\"token text string\">[\"Policy (purpose + TTL)\"]</span> <span class=\"token arrow operator\">--></span> service<span class=\"token text string\">[\"Signer Service\"]</span>\n  service <span class=\"token arrow operator\">--></span> hsm<span class=\"token text string\">[\"HSM/KMS\"]</span>\n  service <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit Stream\"]</span>\n  audit <span class=\"token arrow operator\">--></span> siem<span class=\"token text string\">[\"Detection/Response\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make policy explicit and enforce it in the narrowest component possible.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Capability-style API: callers get a handle scoped to purpose + TTL.</span>\n<span class=\"token keyword\">type</span> KeyPurpose <span class=\"token builtin\">string</span>\n<span class=\"token keyword\">type</span> KeyHandle <span class=\"token keyword\">struct</span> <span class=\"token punctuation\">{</span>\n  ID <span class=\"token builtin\">string</span>\n  Purpose KeyPurpose\n  ExpiresAtUnix <span class=\"token builtin\">int64</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">type</span> Signer <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Sign</span><span class=\"token punctuation\">(</span>h KeyHandle<span class=\"token punctuation\">,</span> msg <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>sig <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n<li><strong>Rotation drills</strong>: staged rollout, dual-sign windows, and rollback.</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Test backup/restore for crypto material with the same rigor as databases.</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Separate duties and restrict production key access paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Real-world PKI incidents and operational lessons.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-02-key-management-at-scale-rotation-audit-and-blast-radius",
            "title": "Key Management at Scale: Rotation, Audit, and Blast Radius",
            "summary": "Spec-driven research note (February 2018): Key Management at Scale: Rotation, Audit, and Blast Radius.",
            "date_modified": "2018-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2018-01-pki-as-an-operating-system-certificates-policies-and-expirat",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Cryptographic Infrastructure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>PKI as an Operating System: Certificates, Policies, and Expiration</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat key IDs as capabilities; never pass raw private key material across boundaries.</li>\n<li>Side-channel constraints turn performance details into security boundaries.</li>\n<li>Bind purpose and context (domain separation) so keys can’t be misused accidentally.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Managed services shift responsibilities; they don’t remove them.</li>\n<li>Most organizations don’t know where their keys live—until an incident.</li>\n<li>Side channels turn performance details into security boundaries.</li>\n<li>Policy drift silently turns strong crypto into weak practice.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the blast radius of compromise (tenant, service, region, environment)?</li>\n<li>What is your disaster recovery story for KMS/HSM outages?</li>\n<li>What is the rollback plan when a new algorithm breaks production?</li>\n<li>What is the root of trust (HSM, TPM, offline CA, threshold ceremony)?</li>\n<li>How do you separate duties (operators vs developers vs security responders)?</li>\n<li>How do you prove usage (who signed what, when, and why) without leaking secrets?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Secrets leak through logs, metrics, crash dumps, and backups unless prevented.</li>\n<li>Some environments are hostile (CI, ephemeral runners, shared build agents).</li>\n<li>Rotation must occur under incident pressure; automation must be safe.</li>\n<li>Key usage is high-volume; audit pipelines must scale without sampling away truth.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Designing audit trails that expose sensitive plaintext or identifiers.</li>\n<li>Assuming “HSM = secure” without defining the threat model.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Audit integrity is a cryptographic property:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">o</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">_</mi><mi mathvariant=\"normal\">e</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">t</mi><mi mathvariant=\"normal\">r</mi><mi mathvariant=\"normal\">y</mi></mrow><mo>←</mo><msub><mrow><mi mathvariant=\"normal\">S</mi><mi mathvariant=\"normal\">i</mi><mi mathvariant=\"normal\">g</mi><mi mathvariant=\"normal\">n</mi></mrow><msub><mi>k</mi><mtext>audit</mtext></msub></msub><mo stretchy=\"false\">(</mo><mrow><mi mathvariant=\"normal\">h</mi><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">s</mi><mi mathvariant=\"normal\">h</mi></mrow><mo stretchy=\"false\">(</mo><mtext>event</mtext><mo stretchy=\"false\">)</mo><mtext> </mtext><mi mathvariant=\"normal\">∥</mi><mtext> metadata</mtext><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{log\\_entry} \\leftarrow \\mathrm{Sign}_{k_\\text{audit}}(\\mathrm{hash}(\\text{event})\\ \\Vert\\ \\text{metadata}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1.0044em;vertical-align:-0.31em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">log_entry</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">←</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.1em;vertical-align:-0.35em;\"></span><span class=\"mord\"><span class=\"mord\"><span class=\"mord mathrm\">Sign</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3448em;\"><span style=\"top:-2.3488em;margin-left:-0.0315em;margin-right:0.0714em;\"><span class=\"pstrut\" style=\"height:2.5em;\"></span><span class=\"sizing reset-size3 size1 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">audit</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.1512em;\"><span></span></span></span></span></span></span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.35em;\"><span></span></span></span></span></span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathrm\">hash</span></span><span class=\"mopen\">(</span><span class=\"mord text\"><span class=\"mord\">event</span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord\">∥</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">metadata</span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Audit logs are evidence. Make them tamper-evident and operationally accessible.</p>\n<p>Assume compromise and design for recovery: rotation, revocation, and forensics.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  gen<span class=\"token text string\">[\"KeyGen (HSM/KMS)\"]</span> <span class=\"token arrow operator\">--></span> use<span class=\"token text string\">[\"Use (TLS/VPN/Signing)\"]</span>\n  use <span class=\"token arrow operator\">--></span> rot<span class=\"token text string\">[\"Rotate (policy + automation)\"]</span>\n  rot <span class=\"token arrow operator\">--></span> revoke<span class=\"token text string\">[\"Revoke (incident)\"]</span>\n  revoke <span class=\"token arrow operator\">--></span> audit<span class=\"token text string\">[\"Audit/Forensics\"]</span>\n  audit <span class=\"token arrow operator\">--></span> gen</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Crypto infra is a product: UX, policy, audit, and rollback must compose.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token attribute attr-name\">#[derive(Clone, Copy, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Purpose</span> <span class=\"token punctuation\">{</span> <span class=\"token class-name\">Tls</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Jwt</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Firmware</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">Ledger</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">KeyHandle</span> <span class=\"token punctuation\">{</span> id<span class=\"token punctuation\">:</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">,</span> purpose<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Purpose</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Enforce purpose and algorithm policy at the boundary, not in the caller.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Config drift detection</strong>: policy-as-code with diffs treated as security events.</li>\n<li><strong>Constant-time validation</strong>: microbenchmarks + side-channel tooling where feasible.</li>\n<li><strong>Forensics tests</strong>: can you reconstruct “who signed what” under load?</li>\n<li><strong>Misuse resistance tests</strong>: wrong purpose, wrong context, wrong key type must fail.</li>\n<li><strong>Chaos for KMS</strong>: inject throttling, partial outages, and latency spikes.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Automate rotation with safety rails (canary, dual-sign, fast rollback).</li>\n<li>Make audit streams append-only and queryable during incidents.</li>\n<li>Alert on policy drift: cipher suites, key sizes, algorithm toggles, TTL changes.</li>\n<li>Inventory keys and usage paths; treat unknown usage as an incident.</li>\n<li>Separate duties and restrict production key access paths.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> <span class=\"citation\" id=\"citation--letsencryptincidents--2\">(<a href=\"#bib-letsencryptincidents\">2</a>)</span> — Real-world PKI incidents and operational lessons.\n<ul>\n<li><strong>Evidence:</strong> Rotation and revocation are operational protocols; extract failure patterns into drills and automated rollbacks.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which secrets must remain confidential for 10+ years and where are they stored today?</li>\n<li>How do you guarantee that audit does not become a data exfiltration channel?</li>\n<li>What would a KMS compromise look like in your telemetry?</li>\n<li>What is your plan for emergency revocation at global scale?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://csrc.nist.gov/publications/detail/sp/800-57-part-1/rev-5/final\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">NIST SP 800-57 Part 1 Rev. 5</a> — Key management guidance: lifecycle, strength, and policy.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc5869\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 5869: HKDF</a> — Domain separation and key derivation done sanely.</li>\n<li><a href=\"https://community.letsencrypt.org/c/incidents/16/l/top\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Let's Encrypt Incident Reports</a> — Real-world PKI incidents and operational lessons.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc8446\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 8446: TLS 1.3</a> — Modern handshake design, key schedule, and downgrade resistance patterns.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-letsencryptincidents\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Let’s Encrypt. Let’s Encrypt Incident Reports [Internet]. Web; Available from: https://community.letsencrypt.org/c/incidents/16/l/top</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2018-01-pki-as-an-operating-system-certificates-policies-and-expirat",
            "title": "PKI as an Operating System: Certificates, Policies, and Expiration",
            "summary": "Correctness-focused deep dive (January 2018): PKI as an Operating System: Certificates, Policies, and Expiration.",
            "date_modified": "2018-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "cryptography",
                "security",
                "security-critical-infrastructure",
                "DevSecOps"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-12-a-minimal-tla-workflow-for-distributed-protocols",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>A Minimal TLA+ Workflow for Distributed Protocols</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Mixed-version operation is the default state of real deployments.</li>\n<li>Most protocol bugs hide in timeouts, retries, and membership changes.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which components require determinism for reproducibility?</li>\n<li>What is the compaction story (snapshots, log truncation, state transfer)?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>How do you prevent overload from becoming inconsistency?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n<li>Delays are unbounded during incidents; timeouts are guesses.</li>\n<li>Clocks drift; leases can be violated under GC pauses or VM stalls.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating membership as static or human-managed only.</li>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For quorum-based protocols, the intersection property is the backbone of safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>Crash-fault: </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>></mo><mfrac><mi>n</mi><mn>2</mn></mfrac><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mtext>Byzantine: </mtext><mi>n</mi><mo>≥</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn><mo separator=\"true\">,</mo><mtext> </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>≥</mo><mn>2</mn><mi>f</mi><mo>+</mo><mn>1.</mn></mrow><annotation encoding=\"application/x-tex\">\\text{Crash-fault: } |Q| > \\frac{n}{2}\\qquad\\qquad\n\\text{Byzantine: } n \\ge 3f+1,\\ |Q| \\ge 2f+1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Crash-fault: </span></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.7936em;vertical-align:-0.686em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.1076em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">2</span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">n</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.686em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">Byzantine: </span></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1.</span></span></span></span></span></div>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> L as Leader\n  <span class=\"token keyword\">participant</span> F1 as Follower 1\n  <span class=\"token keyword\">participant</span> F2 as Follower 2\n  C<span class=\"token arrow operator\">->></span>L<span class=\"token operator\">:</span> propose<span class=\"token text string\">(cmd)</span>\n  L<span class=\"token arrow operator\">->></span>F1<span class=\"token operator\">:</span> appendEntries\n  L<span class=\"token arrow operator\">->></span>F2<span class=\"token operator\">:</span> appendEntries\n  F1<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  F2<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  L<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--2\">(<a href=\"#bib-lamport1978\">2</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-12-a-minimal-tla-workflow-for-distributed-protocols",
            "title": "A Minimal TLA+ Workflow for Distributed Protocols",
            "summary": "Spec-driven research note (December 2017): A Minimal TLA+ Workflow for Distributed Protocols.",
            "date_modified": "2017-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-11-designing-for-network-partitions-degraded-modes-that-still-m",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Designing for Network Partitions: Degraded Modes That Still Make Sense</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational simplicity is a security property: fewer modes, fewer surprises.</li>\n<li>Tail latency is a protocol input: it changes who retries and when.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>Backpressure and fairness are part of correctness when resources are finite.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you prevent overload from becoming inconsistency?</li>\n<li>Which components require determinism for reproducibility?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>What does “read” mean under replication lag?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Delays are unbounded during incidents; timeouts are guesses.</li>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>Under partial synchrony, progress depends on a stabilizing period:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∃</mi><mi>T</mi><mo>:</mo><mtext> </mtext><mi mathvariant=\"normal\">∀</mi><mi>t</mi><mo>≥</mo><mi>T</mi><mo separator=\"true\">,</mo><mtext> messages delivered within </mtext><mi mathvariant=\"normal\">Δ</mi><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\exists T:\\ \\forall t \\ge T,\\ \\text{messages delivered within } \\Delta.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∃</span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8304em;vertical-align:-0.136em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">t</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.13889em;\">T</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord text\"><span class=\"mord\">messages delivered within </span></span><span class=\"mord\">Δ.</span></span></span></span></span></div>\n<p>Make overload explicit: admission control is a protocol boundary.</p>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> L as Leader\n  <span class=\"token keyword\">participant</span> F1 as Follower 1\n  <span class=\"token keyword\">participant</span> F2 as Follower 2\n  C<span class=\"token arrow operator\">->></span>L<span class=\"token operator\">:</span> propose<span class=\"token text string\">(cmd)</span>\n  L<span class=\"token arrow operator\">->></span>F1<span class=\"token operator\">:</span> appendEntries\n  L<span class=\"token arrow operator\">->></span>F2<span class=\"token operator\">:</span> appendEntries\n  F1<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  F2<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  L<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Protocols fail at the boundaries: timeouts, membership, compaction, and overload.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--2\">(<a href=\"#bib-lamport1978\">2</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-11-designing-for-network-partitions-degraded-modes-that-still-m",
            "title": "Designing for Network Partitions: Degraded Modes That Still Make Sense",
            "summary": "Engineering notebook entry (November 2017): Designing for Network Partitions: Degraded Modes That Still Make Sense.",
            "date_modified": "2017-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-10-rate-limiting-and-fairness-protecting-critical-paths",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Rate Limiting and Fairness: Protecting Critical Paths</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most protocol bugs hide in timeouts, retries, and membership changes.</li>\n<li>Mixed-version operation is the default state of real deployments.</li>\n<li>Tail latency is a protocol input: it changes who retries and when.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>Which components require determinism for reproducibility?</li>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>What does “read” mean under replication lag?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n<li>Clocks drift; leases can be violated under GC pauses or VM stalls.</li>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating membership as static or human-managed only.</li>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Liveness is always conditional: specify <em>when</em> progress is expected and what you do otherwise.</p>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Follower\n  Follower <span class=\"token arrow operator\">--></span> Candidate<span class=\"token operator\">:</span> timeout\n  Candidate <span class=\"token arrow operator\">--></span> Leader<span class=\"token operator\">:</span> win quorum\n  Candidate <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> lose\n  Leader <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> stepdown</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Deterministic replay</strong> of network traces to reproduce rare failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> <span class=\"citation\" id=\"citation--ongaro2014raft--1\">(<a href=\"#bib-ongaro2014raft\">1</a>)</span> — Consensus with explicit state machines and practical tradeoffs.\n<ul>\n<li><strong>Evidence:</strong> Track term/commitIndex as explicit evidence; test leader changes and log conflicts as part of rollback behavior.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-ongaro2014raft\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Ongaro D, Ousterhout J. In Search of an Understandable Consensus Algorithm (Raft). In: 2014 USENIX Annual Technical Conference (USENIX ATC 14) [Internet]. 2014. Available from: https://raft.github.io/raft.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-10-rate-limiting-and-fairness-protecting-critical-paths",
            "title": "Rate Limiting and Fairness: Protecting Critical Paths",
            "summary": "Design memo (October 2017): Rate Limiting and Fairness: Protecting Critical Paths.",
            "date_modified": "2017-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-09-queues-streams-exactly-once-semantics-without-lying-to-yours",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Queues &#x26; Streams: Exactly-Once Semantics Without Lying to Yourself</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational simplicity is a security property: fewer modes, fewer surprises.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does “read” mean under replication lag?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>How do you prevent overload from becoming inconsistency?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Delays are unbounded during incidents; timeouts are guesses.</li>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n<li>Clocks drift; leases can be violated under GC pauses or VM stalls.</li>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For quorum-based protocols, the intersection property is the backbone of safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>Crash-fault: </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>></mo><mfrac><mi>n</mi><mn>2</mn></mfrac><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mtext>Byzantine: </mtext><mi>n</mi><mo>≥</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn><mo separator=\"true\">,</mo><mtext> </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>≥</mo><mn>2</mn><mi>f</mi><mo>+</mo><mn>1.</mn></mrow><annotation encoding=\"application/x-tex\">\\text{Crash-fault: } |Q| > \\frac{n}{2}\\qquad\\qquad\n\\text{Byzantine: } n \\ge 3f+1,\\ |Q| \\ge 2f+1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Crash-fault: </span></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.7936em;vertical-align:-0.686em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.1076em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">2</span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">n</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.686em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">Byzantine: </span></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1.</span></span></span></span></span></div>\n<p>Make overload explicit: admission control is a protocol boundary.</p>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Follower\n  Follower <span class=\"token arrow operator\">--></span> Candidate<span class=\"token operator\">:</span> timeout\n  Candidate <span class=\"token arrow operator\">--></span> Leader<span class=\"token operator\">:</span> win quorum\n  Candidate <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> lose\n  Leader <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> stepdown</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make the state machine explicit; then make persistence and networking boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">LogIndex</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">Entry</span> <span class=\"token punctuation\">{</span>\n  index<span class=\"token punctuation\">:</span> <span class=\"token class-name\">LogIndex</span><span class=\"token punctuation\">,</span>\n  term<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">,</span>\n  bytes<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Persist(term, vote, log) before acknowledging anything.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Deterministic replay</strong> of network traces to reproduce rare failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--2\">(<a href=\"#bib-lamport1978\">2</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-09-queues-streams-exactly-once-semantics-without-lying-to-yours",
            "title": "Queues & Streams: Exactly-Once Semantics Without Lying to Yourself",
            "summary": "Design memo (September 2017): Queues & Streams: Exactly-Once Semantics Without Lying to Yourself.",
            "date_modified": "2017-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-08-geo-replication-latency-budgets-and-cross-region-failure-mod",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Geo-Replication: Latency Budgets and Cross-Region Failure Modes</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Tail latency is a protocol input: it changes who retries and when.</li>\n<li>Mixed-version operation is the default state of real deployments.</li>\n<li>Operational simplicity is a security property: fewer modes, fewer surprises.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>What is the compaction story (snapshots, log truncation, state transfer)?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>Which components require determinism for reproducibility?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n<li>How do you prevent overload from becoming inconsistency?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For quorum-based protocols, the intersection property is the backbone of safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>Crash-fault: </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>></mo><mfrac><mi>n</mi><mn>2</mn></mfrac><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mtext>Byzantine: </mtext><mi>n</mi><mo>≥</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn><mo separator=\"true\">,</mo><mtext> </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>≥</mo><mn>2</mn><mi>f</mi><mo>+</mo><mn>1.</mn></mrow><annotation encoding=\"application/x-tex\">\\text{Crash-fault: } |Q| > \\frac{n}{2}\\qquad\\qquad\n\\text{Byzantine: } n \\ge 3f+1,\\ |Q| \\ge 2f+1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Crash-fault: </span></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.7936em;vertical-align:-0.686em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.1076em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">2</span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">n</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.686em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">Byzantine: </span></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1.</span></span></span></span></span></div>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> L as Leader\n  <span class=\"token keyword\">participant</span> F1 as Follower 1\n  <span class=\"token keyword\">participant</span> F2 as Follower 2\n  C<span class=\"token arrow operator\">->></span>L<span class=\"token operator\">:</span> propose<span class=\"token text string\">(cmd)</span>\n  L<span class=\"token arrow operator\">->></span>F1<span class=\"token operator\">:</span> appendEntries\n  L<span class=\"token arrow operator\">->></span>F2<span class=\"token operator\">:</span> appendEntries\n  F1<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  F2<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  L<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Protocols fail at the boundaries: timeouts, membership, compaction, and overload.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--2\">(<a href=\"#bib-lamport1978\">2</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-08-geo-replication-latency-budgets-and-cross-region-failure-mod",
            "title": "Geo-Replication: Latency Budgets and Cross-Region Failure Modes",
            "summary": "Threat-model-first analysis (August 2017): Geo-Replication: Latency Budgets and Cross-Region Failure Modes.",
            "date_modified": "2017-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-07-gossip-epidemic-dissemination-fast-probabilistic-and-weird",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Gossip &#x26; Epidemic Dissemination: Fast, Probabilistic, and Weird</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Tail latency is a protocol input: it changes who retries and when.</li>\n<li>Safety failures are permanent; liveness failures are (sometimes) recoverable.</li>\n<li>Global systems fail in correlated ways (regions, dependencies, routing).</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>What is the compaction story (snapshots, log truncation, state transfer)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Packets can be duplicated and reordered; acks can be lost.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Delays are unbounded during incidents; timeouts are guesses.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n<li>Pretending backpressure is an implementation detail.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<p>Liveness is always conditional: specify <em>when</em> progress is expected and what you do otherwise.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Follower\n  Follower <span class=\"token arrow operator\">--></span> Candidate<span class=\"token operator\">:</span> timeout\n  Candidate <span class=\"token arrow operator\">--></span> Leader<span class=\"token operator\">:</span> win quorum\n  Candidate <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> lose\n  Leader <span class=\"token arrow operator\">--></span> Follower<span class=\"token operator\">:</span> stepdown</code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Protocols fail at the boundaries: timeouts, membership, compaction, and overload.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Deterministic replay</strong> of network traces to reproduce rare failures.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--2\">(<a href=\"#bib-lamport1978\">2</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-07-gossip-epidemic-dissemination-fast-probabilistic-and-weird",
            "title": "Gossip & Epidemic Dissemination: Fast, Probabilistic, and Weird",
            "summary": "Threat-model-first analysis (July 2017): Gossip & Epidemic Dissemination: Fast, Probabilistic, and Weird.",
            "date_modified": "2017-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-06-transactions-2pc-3pc-and-coordinators-you-cant-trust",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Transactions: 2PC, 3PC, and Coordinators You Can't Trust</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Operational simplicity is a security property: fewer modes, fewer surprises.</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>What does “read” mean under replication lag?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>Which components require determinism for reproducibility?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Delays are unbounded during incidents; timeouts are guesses.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Packets can be duplicated and reordered; acks can be lost.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<p>Liveness is always conditional: specify <em>when</em> progress is expected and what you do otherwise.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  client<span class=\"token text string\">[\"Client\"]</span> <span class=\"token arrow operator\">--></span> leader<span class=\"token text string\">[\"Leader\"]</span>\n  leader <span class=\"token arrow operator\">--></span> log<span class=\"token text string\">[\"Replicated Log\"]</span>\n  log <span class=\"token arrow operator\">--></span> snap<span class=\"token text string\">[\"Snapshot\"]</span>\n  snap <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recovery / Catch-up\"]</span>\n  leader <span class=\"token arrow operator\">--></span> reconfig<span class=\"token text string\">[\"Reconfiguration\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make the state machine explicit; then make persistence and networking boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> <span class=\"citation\" id=\"citation--ongaro2014raft--2\">(<a href=\"#bib-ongaro2014raft\">2</a>)</span> — Consensus with explicit state machines and practical tradeoffs.\n<ul>\n<li><strong>Evidence:</strong> Track term/commitIndex as explicit evidence; test leader changes and log conflicts as part of rollback behavior.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-ongaro2014raft\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Ongaro D, Ousterhout J. In Search of an Understandable Consensus Algorithm (Raft). In: 2014 USENIX Annual Technical Conference (USENIX ATC 14) [Internet]. 2014. Available from: https://raft.github.io/raft.pdf</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-06-transactions-2pc-3pc-and-coordinators-you-cant-trust",
            "title": "Transactions: 2PC, 3PC, and Coordinators You Can't Trust",
            "summary": "Design memo (June 2017): Transactions: 2PC, 3PC, and Coordinators You Can't Trust.",
            "date_modified": "2017-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-05-consistency-models-linearizability-serializability-and-what-",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Consistency Models: Linearizability, Serializability, and What You Actually Need</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Observability must explain protocol state, not just latency.</li>\n<li>Tail latency is a protocol input: it changes who retries and when.</li>\n<li>Backpressure and fairness are part of correctness when resources are finite.</li>\n<li>Global systems fail in correlated ways (regions, dependencies, routing).</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Clocks drift; leases can be violated under GC pauses or VM stalls.</li>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> L as Leader\n  <span class=\"token keyword\">participant</span> F1 as Follower 1\n  <span class=\"token keyword\">participant</span> F2 as Follower 2\n  C<span class=\"token arrow operator\">->></span>L<span class=\"token operator\">:</span> propose<span class=\"token text string\">(cmd)</span>\n  L<span class=\"token arrow operator\">->></span>F1<span class=\"token operator\">:</span> appendEntries\n  L<span class=\"token arrow operator\">->></span>F2<span class=\"token operator\">:</span> appendEntries\n  F1<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  F2<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  L<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">LogIndex</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">Entry</span> <span class=\"token punctuation\">{</span>\n  index<span class=\"token punctuation\">:</span> <span class=\"token class-name\">LogIndex</span><span class=\"token punctuation\">,</span>\n  term<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">,</span>\n  bytes<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Persist(term, vote, log) before acknowledging anything.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Deterministic replay</strong> of network traces to reproduce rare failures.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--1\">(<a href=\"#bib-beyer2016sre\">1</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-05-consistency-models-linearizability-serializability-and-what-",
            "title": "Consistency Models: Linearizability, Serializability, and What You Actually Need",
            "summary": "Design memo (May 2017): Consistency Models: Linearizability, Serializability, and What You Actually Need.",
            "date_modified": "2017-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-04-membership-reconfiguration-changing-the-set-without-breaking",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Membership &#x26; Reconfiguration: Changing the Set Without Breaking Safety</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Write the safety property first; liveness is always conditional on timing assumptions.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Safety failures are permanent; liveness failures are (sometimes) recoverable.</li>\n<li>Most protocol bugs hide in timeouts, retries, and membership changes.</li>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>What does “read” mean under replication lag?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>Which components require determinism for reproducibility?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Packets can be duplicated and reordered; acks can be lost.</li>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<p>Make overload explicit: admission control is a protocol boundary.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  client<span class=\"token text string\">[\"Client\"]</span> <span class=\"token arrow operator\">--></span> leader<span class=\"token text string\">[\"Leader\"]</span>\n  leader <span class=\"token arrow operator\">--></span> log<span class=\"token text string\">[\"Replicated Log\"]</span>\n  log <span class=\"token arrow operator\">--></span> snap<span class=\"token text string\">[\"Snapshot\"]</span>\n  snap <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recovery / Catch-up\"]</span>\n  leader <span class=\"token arrow operator\">--></span> reconfig<span class=\"token text string\">[\"Reconfiguration\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">LogIndex</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">struct</span> <span class=\"token type-definition class-name\">Entry</span> <span class=\"token punctuation\">{</span>\n  index<span class=\"token punctuation\">:</span> <span class=\"token class-name\">LogIndex</span><span class=\"token punctuation\">,</span>\n  term<span class=\"token punctuation\">:</span> <span class=\"token keyword\">u64</span><span class=\"token punctuation\">,</span>\n  bytes<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Persist(term, vote, log) before acknowledging anything.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> <span class=\"citation\" id=\"citation--ongaro2014raft--1\">(<a href=\"#bib-ongaro2014raft\">1</a>)</span> — Consensus with explicit state machines and practical tradeoffs.\n<ul>\n<li><strong>Evidence:</strong> Track term/commitIndex as explicit evidence; test leader changes and log conflicts as part of rollback behavior.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-ongaro2014raft\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Ongaro D, Ousterhout J. In Search of an Understandable Consensus Algorithm (Raft). In: 2014 USENIX Annual Technical Conference (USENIX ATC 14) [Internet]. 2014. Available from: https://raft.github.io/raft.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-04-membership-reconfiguration-changing-the-set-without-breaking",
            "title": "Membership & Reconfiguration: Changing the Set Without Breaking Safety",
            "summary": "Adversarial-first deep dive (April 2017): Membership & Reconfiguration: Changing the Set Without Breaking Safety.",
            "date_modified": "2017-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-03-bft-from-first-principles-safety-liveness-and-quorums",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>BFT from First Principles: Safety, Liveness, and Quorums</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Make boundaries boring: validate inputs, cap costs, and be deterministic where needed.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>State compaction and snapshots are where correctness goes to die quietly.</li>\n<li>Most protocol bugs hide in timeouts, retries, and membership changes.</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which components require determinism for reproducibility?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>What is the compaction story (snapshots, log truncation, state transfer)?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>What is the failure model (crash, byzantine, partitions, reordering)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Partitions happen at multiple layers (network, DNS, LB, service mesh).</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on global time for ordering without strong synchronization assumptions.</li>\n<li>Pretending backpressure is an implementation detail.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For quorum-based protocols, the intersection property is the backbone of safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>Crash-fault: </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>></mo><mfrac><mi>n</mi><mn>2</mn></mfrac><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mtext>Byzantine: </mtext><mi>n</mi><mo>≥</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn><mo separator=\"true\">,</mo><mtext> </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>≥</mo><mn>2</mn><mi>f</mi><mo>+</mo><mn>1.</mn></mrow><annotation encoding=\"application/x-tex\">\\text{Crash-fault: } |Q| > \\frac{n}{2}\\qquad\\qquad\n\\text{Byzantine: } n \\ge 3f+1,\\ |Q| \\ge 2f+1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Crash-fault: </span></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.7936em;vertical-align:-0.686em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.1076em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">2</span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">n</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.686em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">Byzantine: </span></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1.</span></span></span></span></span></div>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<p>Make overload explicit: admission control is a protocol boundary.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  client<span class=\"token text string\">[\"Client\"]</span> <span class=\"token arrow operator\">--></span> leader<span class=\"token text string\">[\"Leader\"]</span>\n  leader <span class=\"token arrow operator\">--></span> log<span class=\"token text string\">[\"Replicated Log\"]</span>\n  log <span class=\"token arrow operator\">--></span> snap<span class=\"token text string\">[\"Snapshot\"]</span>\n  snap <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recovery / Catch-up\"]</span>\n  leader <span class=\"token arrow operator\">--></span> reconfig<span class=\"token text string\">[\"Reconfiguration\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Make the state machine explicit; then make persistence and networking boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-03-bft-from-first-principles-safety-liveness-and-quorums",
            "title": "BFT from First Principles: Safety, Liveness, and Quorums",
            "summary": "Adversarial-first deep dive (March 2017): BFT from First Principles: Safety, Liveness, and Quorums.",
            "date_modified": "2017-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-02-consensus-under-partial-synchrony-from-paxos-to-raft",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Consensus Under Partial Synchrony: From Paxos to Raft</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Mixed-version operation is the default; upgrades must preserve invariants.</li>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most protocol bugs hide in timeouts, retries, and membership changes.</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n<li>Global systems fail in correlated ways (regions, dependencies, routing).</li>\n<li>Safety failures are permanent; liveness failures are (sometimes) recoverable.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which components require determinism for reproducibility?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n<li>Which safety property is non-negotiable (no double-commit, no forks, no split brain)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>How do you prevent overload from becoming inconsistency?</li>\n<li>What is the compaction story (snapshots, log truncation, state transfer)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Reconfigurations happen mid-incident (the worst time).</li>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Packets can be duplicated and reordered; acks can be lost.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating membership as static or human-managed only.</li>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For quorum-based protocols, the intersection property is the backbone of safety:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mtext>Crash-fault: </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>></mo><mfrac><mi>n</mi><mn>2</mn></mfrac><mspace width=\"2em\"></mspace><mspace width=\"2em\"></mspace><mtext>Byzantine: </mtext><mi>n</mi><mo>≥</mo><mn>3</mn><mi>f</mi><mo>+</mo><mn>1</mn><mo separator=\"true\">,</mo><mtext> </mtext><mi mathvariant=\"normal\">∣</mi><mi>Q</mi><mi mathvariant=\"normal\">∣</mi><mo>≥</mo><mn>2</mn><mi>f</mi><mo>+</mo><mn>1.</mn></mrow><annotation encoding=\"application/x-tex\">\\text{Crash-fault: } |Q| > \\frac{n}{2}\\qquad\\qquad\n\\text{Byzantine: } n \\ge 3f+1,\\ |Q| \\ge 2f+1.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Crash-fault: </span></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1.7936em;vertical-align:-0.686em;\"></span><span class=\"mord\"><span class=\"mopen nulldelimiter\"></span><span class=\"mfrac\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:1.1076em;\"><span style=\"top:-2.314em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord\">2</span></span></span><span style=\"top:-3.23em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"frac-line\" style=\"border-bottom-width:0.04em;\"></span></span><span style=\"top:-3.677em;\"><span class=\"pstrut\" style=\"height:3em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">n</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.686em;\"><span></span></span></span></span></span><span class=\"mclose nulldelimiter\"></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">Byzantine: </span></span><span class=\"mord mathnormal\">n</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">3</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\">1</span><span class=\"mpunct\">,</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\">∣</span><span class=\"mord mathnormal\">Q</span><span class=\"mord\">∣</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">≥</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"mord\">2</span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">+</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6444em;\"></span><span class=\"mord\">1.</span></span></span></span></span></div>\n<p>Liveness is always conditional: specify <em>when</em> progress is expected and what you do otherwise.</p>\n<p>Write down the safety property first. If it’s not written, it’s not implemented.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> L as Leader\n  <span class=\"token keyword\">participant</span> F1 as Follower 1\n  <span class=\"token keyword\">participant</span> F2 as Follower 2\n  C<span class=\"token arrow operator\">->></span>L<span class=\"token operator\">:</span> propose<span class=\"token text string\">(cmd)</span>\n  L<span class=\"token arrow operator\">->></span>F1<span class=\"token operator\">:</span> appendEntries\n  L<span class=\"token arrow operator\">->></span>F2<span class=\"token operator\">:</span> appendEntries\n  F1<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  F2<span class=\"token arrow operator\">-->></span>L<span class=\"token operator\">:</span> ack\n  L<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n<li><strong>Linearizability checks</strong> for read/write APIs that claim it.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n<li>Prefer monotonic time sources for leases; alert on clock discontinuities.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — Practical entry point for specification and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-02-consensus-under-partial-synchrony-from-paxos-to-raft",
            "title": "Consensus Under Partial Synchrony: From Paxos to Raft",
            "summary": "Correctness-focused deep dive (February 2017): Consensus Under Partial Synchrony: From Paxos to Raft.",
            "date_modified": "2017-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2017-01-state-machine-replication-log-design-snapshots-and-compactio",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Distributed Systems Under Failure</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>State Machine Replication: Log Design, Snapshots, and Compaction</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Expose protocol state (epoch/term/commit index) as first-class telemetry.</li>\n<li>Treat membership changes and compaction as protocol events—not operational details.</li>\n<li>Backpressure and admission control are correctness mechanisms under load.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Bind security decisions to evidence (audit, invariants, telemetry).</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Safety failures are permanent; liveness failures are (sometimes) recoverable.</li>\n<li>Global systems fail in correlated ways (regions, dependencies, routing).</li>\n<li>If your protocol isn’t testable under reordering, it isn’t deployable.</li>\n<li>Observability must explain protocol state, not just latency.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does “read” mean under replication lag?</li>\n<li>What is the unit of ordering (per key, per partition, global)?</li>\n<li>What is your reconfiguration model (joint consensus, epochs, leases)?</li>\n<li>How do clients discover leaders safely (and what happens during flaps)?</li>\n<li>Where do you pay for liveness (timeouts, leader election, reconfiguration)?</li>\n<li>How do you prevent overload from becoming inconsistency?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Workload is skewed: hot keys exist and dominate.</li>\n<li>Nodes restart with partial state unless you prove durability.</li>\n<li>Clients retry and amplify load right when the system is weakest.</li>\n<li>Packets can be duplicated and reordered; acks can be lost.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Pretending backpressure is an implementation detail.</li>\n<li>Assuming the network eventually behaves “nicely” under load.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common safety shape for replicated logs:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi mathvariant=\"normal\">∀</mi><mi>i</mi><mo>:</mo><mtext> Committed</mtext><mo stretchy=\"false\">(</mo><mi>i</mi><mo stretchy=\"false\">)</mo><mo>⇒</mo><mi mathvariant=\"normal\">∀</mi><mi>r</mi><mo>:</mo><mtext> </mtext><msub><mtext>Log</mtext><mi>r</mi></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mo>=</mo><msub><mtext>Log</mtext><mtext>leader</mtext></msub><mo stretchy=\"false\">[</mo><mi>i</mi><mo stretchy=\"false\">]</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\forall i:\\ \\text{Committed}(i)\\Rightarrow \\forall r:\\ \\text{Log}_r[i] = \\text{Log}_\\text{leader}[i].</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\">i</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord text\"><span class=\"mord\">Committed</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord\">∀</span><span class=\"mord mathnormal\" style=\"margin-right:0.02778em;\">r</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">:</span><span class=\"mspace\"> </span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.0573em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\" style=\"margin-right:0.02778em;\">r</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord text\"><span class=\"mord\">Log</span></span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.242em;\"><span style=\"top:-2.4559em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">leader</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2441em;\"><span></span></span></span></span></span></span><span class=\"mopen\">[</span><span class=\"mord mathnormal\">i</span><span class=\"mclose\">]</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Liveness is always conditional: specify <em>when</em> progress is expected and what you do otherwise.</p>\n<p>Treat membership changes as protocol events, not control-plane side effects.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  client<span class=\"token text string\">[\"Client\"]</span> <span class=\"token arrow operator\">--></span> leader<span class=\"token text string\">[\"Leader\"]</span>\n  leader <span class=\"token arrow operator\">--></span> log<span class=\"token text string\">[\"Replicated Log\"]</span>\n  log <span class=\"token arrow operator\">--></span> snap<span class=\"token text string\">[\"Snapshot\"]</span>\n  snap <span class=\"token arrow operator\">--></span> recover<span class=\"token text string\">[\"Recovery / Catch-up\"]</span>\n  leader <span class=\"token arrow operator\">--></span> reconfig<span class=\"token text string\">[\"Reconfiguration\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Your protocol is an interface between failures and invariants. Encode both.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>If you can’t explain a timeout outcome, you can’t make retries safe.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Operational invariants to monitor:\n- leader_changes_per_minute\n- commit_index_monotonic\n- snapshot_install_failures\n- quorum_acks_latency_p99\n- rejected_requests_due_to_admission_control</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Jepsen-style</strong> fault injection: partitions + reordering + client retries.</li>\n<li><strong>Upgrade tests</strong>: mixed versions and rolling deploy invariants.</li>\n<li><strong>Deterministic replay</strong> of network traces to reproduce rare failures.</li>\n<li><strong>Model checking</strong> the smallest core (timeouts, election, reconfiguration).</li>\n<li><strong>Stress + skew</strong> tests: hot keys, slow disks, noisy neighbors.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Expose protocol state: term/epoch, leader, commit index, config version.</li>\n<li>Make client behavior part of the system: document retry semantics.</li>\n<li>Treat compaction and snapshot install as first-class SLOs.</li>\n<li>Rehearse region failover and reconfiguration under load.</li>\n<li>Rate-limit retries and apply admission control before saturation.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> <span class=\"citation\" id=\"citation--lamport1978--1\">(<a href=\"#bib-lamport1978\">1</a>)</span> — Causality, ordering, and why clocks are tricky.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Testing correctness under partitions and faults.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which invariants are violated first under overload: latency, availability, or correctness?</li>\n<li>What is the worst-case recovery time after a leader + disk failure?</li>\n<li>How do you prevent “operator fixes” from changing safety properties?</li>\n<li>Where does your protocol assume synchrony without admitting it?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Testing correctness under partitions and faults.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport)</a> — Causality, ordering, and why clocks are tricky.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — Agreement basics and the invariants that matter.</li>\n<li><a href=\"https://raft.github.io/raft.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">In Search of an Understandable Consensus Algorithm (Raft)</a> — Consensus with explicit state machines and practical tradeoffs.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — Practical entry point for specification and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2017-01-state-machine-replication-log-design-snapshots-and-compactio",
            "title": "State Machine Replication: Log Design, Snapshots, and Compaction",
            "summary": "Adversarial-first deep dive (January 2017): State Machine Replication: Log Design, Snapshots, and Compaction.",
            "date_modified": "2017-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "distributed-systems",
                "protocol-design",
                "resilience",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-12-security-vs-reliability-when-the-same-bug-has-two-names",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Security vs Reliability: When the Same Bug Has Two Names</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Correctness is a property you enforce at boundaries: parsing, persistence, concurrency, RPC.</li>\n<li>The cost of unclear invariants is paid in production, under load, during an incident.</li>\n<li>Correctness bugs are indistinguishable from security incidents when the system is adversarial.</li>\n<li>Most outages are “state management” failures: partial writes, ambiguous outcomes, invalid transitions.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>How do you ensure deduplication is scoped correctly (tenant, resource, operation)?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Requests can be duplicated, reordered, delayed, and replayed across restarts.</li>\n<li>Partial failure is normal: one replica slow, one unavailable, one returning stale data.</li>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Baking invariants into tribal knowledge instead of code.</li>\n<li>Letting recovery be “restart the service and hope.”</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>We want a transition function <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>δ</mi></mrow><annotation encoding=\"application/x-tex\">\\delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span></span></span></span></span> and invariant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>δ</mi><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo separator=\"true\">,</mo><msub><mi>e</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mo>∧</mo><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_{t+1} = \\delta(s_t, e_t)\\qquad\\wedge\\qquad \\mathrm{Inv}(s_t)\\Rightarrow \\mathrm{Inv}(s_{t+1}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6389em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>If you can’t define what a timeout means, you can’t implement retries safely. Make ambiguity explicit in the API.</p>\n<p>Crash points matter: define what happens if the process stops after each line that mutates state or acknowledges work.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The goal isn’t cleverness—it’s eliminating ambiguity at boundaries and making recovery boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Idempotency sketch: reserve -> execute -> commit result (or return cached).</span>\n<span class=\"token keyword\">type</span> Key <span class=\"token builtin\">string</span>\n\n<span class=\"token keyword\">type</span> Store <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Get</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> ok <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n  <span class=\"token function\">PutIfAbsent</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">,</span> value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>stored <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Security vs Reliability: When the Same Bug Has Two Names: \"timeout\" must not mean \"try again and maybe double-apply\".</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--1\">(<a href=\"#bib-learntla\">1</a>)</span> — A pragmatic workflow for invariants and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--2\">(<a href=\"#bib-kleppmann2017ddia\">2</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-12-security-vs-reliability-when-the-same-bug-has-two-names",
            "title": "Security vs Reliability: When the Same Bug Has Two Names",
            "summary": "Correctness-focused deep dive (December 2016): Security vs Reliability: When the Same Bug Has Two Names.",
            "date_modified": "2016-12-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-11-reproducible-builds-trusting-artifacts-in-a-hostile-world",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Reproducible Builds: Trusting Artifacts in a Hostile World</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Interfaces that allow invalid state guarantee someone will eventually produce it.</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n<li>“Works in tests” often means “fails under reordering and retries.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>What must be durable before you acknowledge?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>How do you ensure deduplication is scoped correctly (tenant, resource, operation)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Errors are lossy: transient vs permanent is often indistinguishable at the boundary.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Letting recovery be “restart the service and hope.”</li>\n<li>Perfect exactly-once semantics across an untrusted network without coordination.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For idempotent operations, the contract is <em>set-like</em>:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><mi>k</mi><mo stretchy=\"false\">)</mo><mo>=</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><mi>k</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>and</mtext><mspace width=\"1em\"></mspace><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><msub><mi>k</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">≠</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><msub><mi>k</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mtext> in general</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{apply}(s, op, k) = \\mathrm{apply}(s, op, k) \\quad\\text{and}\\quad\n\\mathrm{apply}(s, op, k_1) \\neq \\mathrm{apply}(s, op, k_2)\\ \\text{in general}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mrel\"><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"rlap\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mrel\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace nobreak\"></span><span class=\"mrel\">=</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">in general</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat invariants as a first-class interface: a function that cannot check its invariants cannot be safely composed. Start with the smallest invariant that is both meaningful and enforceable at your boundaries.</p>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Correctness lives in the seams: encoding, persistence, concurrency, and retries.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Reproducible Builds: Trusting Artifacts in a Hostile World: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Make rollbacks safe: schema and protocol compatibility is a security boundary.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Validate time assumptions: alert on clock steps, skew, and monotonicity issues.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--2\">(<a href=\"#bib-rfc9110\">2</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-11-reproducible-builds-trusting-artifacts-in-a-hostile-world",
            "title": "Reproducible Builds: Trusting Artifacts in a Hostile World",
            "summary": "Threat-model-first analysis (November 2016): Reproducible Builds: Trusting Artifacts in a Hostile World.",
            "date_modified": "2016-11-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-10-observability-as-specification-slos-error-budgets-and-contra",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Observability as Specification: SLOs, Error Budgets, and Contracts</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n<li>Make failure modes explicit and observable.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Your on-call runbook is part of the specification—make it match the code.</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>In distributed code, retries and duplication are the common case—not the edge case.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Requests can be duplicated, reordered, delayed, and replayed across restarts.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n<li>Time is untrusted: clock skew, NTP steps, monotonic vs wall-clock confusion.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Letting recovery be “restart the service and hope.”</li>\n<li>Assuming a single authoritative clock that never moves backwards.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common pattern is splitting state into durable vs derived:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>S</mi><mo>=</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo>×</mo><msub><mi>S</mi><mtext>derived</mtext></msub><mspace width=\"2em\"></mspace><mtext>and</mtext><mspace width=\"2em\"></mspace><msub><mi>S</mi><mtext>derived</mtext></msub><mo>=</mo><mi>f</mi><mo stretchy=\"false\">(</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">S = S_\\text{durable} \\times S_\\text{derived}\\qquad\\text{and}\\qquad S_\\text{derived} = f(S_\\text{durable}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Prefer <em>monotonic</em> identifiers at boundaries (sequence numbers, epochs, version vectors) so that replays are detectable and order can be reasoned about.</p>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The goal isn’t cleverness—it’s eliminating ambiguity at boundaries and making recovery boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Observability as Specification: SLOs, Error Budgets, and Contracts: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--1\">(<a href=\"#bib-rfc9110\">1</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — A pragmatic workflow for invariants and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-10-observability-as-specification-slos-error-budgets-and-contra",
            "title": "Observability as Specification: SLOs, Error Budgets, and Contracts",
            "summary": "Design memo (October 2016): Observability as Specification: SLOs, Error Budgets, and Contracts.",
            "date_modified": "2016-10-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-09-fault-injection-turning-unknown-unknowns-into-test-cases",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Fault Injection: Turning Unknown Unknowns into Test Cases</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Separate durable state from derived state; derived must be recomputable or reconcilable.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Correctness is a property you enforce at boundaries: parsing, persistence, concurrency, RPC.</li>\n<li>The cost of unclear invariants is paid in production, under load, during an incident.</li>\n<li>If recovery is not specified, recovery becomes improvisation.</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>How do you ensure deduplication is scoped correctly (tenant, resource, operation)?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Time is untrusted: clock skew, NTP steps, monotonic vs wall-clock confusion.</li>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Errors are lossy: transient vs permanent is often indistinguishable at the boundary.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Treating retries as a transport detail rather than a semantic constraint.</li>\n<li>Assuming a single authoritative clock that never moves backwards.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common pattern is splitting state into durable vs derived:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>S</mi><mo>=</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo>×</mo><msub><mi>S</mi><mtext>derived</mtext></msub><mspace width=\"2em\"></mspace><mtext>and</mtext><mspace width=\"2em\"></mspace><msub><mi>S</mi><mtext>derived</mtext></msub><mo>=</mo><mi>f</mi><mo stretchy=\"false\">(</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">S = S_\\text{durable} \\times S_\\text{derived}\\qquad\\text{and}\\qquad S_\\text{derived} = f(S_\\text{durable}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Crash points matter: define what happens if the process stops after each line that mutates state or acknowledges work.</p>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Init\n  Init <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> bootstrap<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Ready <span class=\"token arrow operator\">--></span> Processing<span class=\"token operator\">:</span> event<span class=\"token text string\">(e)</span>\n  Processing <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> commit<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Processing <span class=\"token arrow operator\">--></span> Error<span class=\"token operator\">:</span> violate<span class=\"token text string\">(Inv)</span>\n  Error <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> recover<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The goal isn’t cleverness—it’s eliminating ambiguity at boundaries and making recovery boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Fault Injection: Turning Unknown Unknowns into Test Cases: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--1\">(<a href=\"#bib-rfc9110\">1</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Failure testing focused on correctness under partitions and reordering.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-09-fault-injection-turning-unknown-unknowns-into-test-cases",
            "title": "Fault Injection: Turning Unknown Unknowns into Test Cases",
            "summary": "Spec-driven research note (September 2016): Fault Injection: Turning Unknown Unknowns into Test Cases.",
            "date_modified": "2016-09-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-08-memory-models-and-concurrency-reasoning-about-races",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Memory Models and Concurrency: Reasoning About Races</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Most outages are “state management” failures: partial writes, ambiguous outcomes, invalid transitions.</li>\n<li>Correctness bugs are indistinguishable from security incidents when the system is adversarial.</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>The cost of unclear invariants is paid in production, under load, during an incident.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>What must be durable before you acknowledge?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Letting recovery be “restart the service and hope.”</li>\n<li>Perfect exactly-once semantics across an untrusted network without coordination.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>We want a transition function <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>δ</mi></mrow><annotation encoding=\"application/x-tex\">\\delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span></span></span></span></span> and invariant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>δ</mi><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo separator=\"true\">,</mo><msub><mi>e</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mo>∧</mo><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_{t+1} = \\delta(s_t, e_t)\\qquad\\wedge\\qquad \\mathrm{Inv}(s_t)\\Rightarrow \\mathrm{Inv}(s_{t+1}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6389em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<p>If you can’t define what a timeout means, you can’t implement retries safely. Make ambiguity explicit in the API.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> API as API\n  <span class=\"token keyword\">participant</span> DB as Durable Store\n  C<span class=\"token arrow operator\">->></span>API<span class=\"token operator\">:</span> request<span class=\"token text string\">(op, idempotency_key)</span>\n  API<span class=\"token arrow operator\">->></span>DB<span class=\"token operator\">:</span> check_or_reserve<span class=\"token text string\">(key)</span>\n  DB<span class=\"token arrow operator\">-->></span>API<span class=\"token operator\">:</span> miss | hit<span class=\"token text string\">(result)</span>\n  API<span class=\"token arrow operator\">->></span>DB<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span>\n  API<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> ack<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Correctness lives in the seams: encoding, persistence, concurrency, and retries.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Correctness checklist:\n1) Define state (durable vs derived).\n2) Enumerate transitions.\n3) Write invariants (safety) and progress conditions (liveness).\n4) Pick crash points and specify recovery.\n5) Make retries part of semantics (idempotency keys, monotonic versions).</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Make rollbacks safe: schema and protocol compatibility is a security boundary.</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Validate time assumptions: alert on clock steps, skew, and monotonicity issues.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> <span class=\"citation\" id=\"citation--learntla--2\">(<a href=\"#bib-learntla\">2</a>)</span> — A pragmatic workflow for invariants and model checking.\n<ul>\n<li><strong>Evidence:</strong> Model the smallest thing that can break; use model checking to validate invariants before optimizing.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-learntla\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">LearnTLA. Learn TLA+ [Internet]. Web; Available from: https://learntla.com/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-08-memory-models-and-concurrency-reasoning-about-races",
            "title": "Memory Models and Concurrency: Reasoning About Races",
            "summary": "Threat-model-first analysis (August 2016): Memory Models and Concurrency: Reasoning About Races.",
            "date_modified": "2016-08-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-07-crash-consistency-durable-state-without-mysticism",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Crash Consistency: Durable State Without Mysticism</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Most failures are boundary failures: parsing, persistence, concurrency, retries, and upgrades.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Separate durable state from derived state; derived must be recomputable or reconcilable.</li>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>The cost of unclear invariants is paid in production, under load, during an incident.</li>\n<li>Performance work that changes semantics is a correctness regression with a nicer latency chart.</li>\n<li>In distributed code, retries and duplication are the common case—not the edge case.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>Where do you need atomicity (and where is eventual consistency acceptable)?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Requests can be duplicated, reordered, delayed, and replayed across restarts.</li>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Time is untrusted: clock skew, NTP steps, monotonic vs wall-clock confusion.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “best effort” client behavior for safety properties.</li>\n<li>Baking invariants into tribal knowledge instead of code.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>For idempotent operations, the contract is <em>set-like</em>:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><mi>k</mi><mo stretchy=\"false\">)</mo><mo>=</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><mi>k</mi><mo stretchy=\"false\">)</mo><mspace width=\"1em\"></mspace><mtext>and</mtext><mspace width=\"1em\"></mspace><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><msub><mi>k</mi><mn>1</mn></msub><mo stretchy=\"false\">)</mo><mo mathvariant=\"normal\">≠</mo><mrow><mi mathvariant=\"normal\">a</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">p</mi><mi mathvariant=\"normal\">l</mi><mi mathvariant=\"normal\">y</mi></mrow><mo stretchy=\"false\">(</mo><mi>s</mi><mo separator=\"true\">,</mo><mi>o</mi><mi>p</mi><mo separator=\"true\">,</mo><msub><mi>k</mi><mn>2</mn></msub><mo stretchy=\"false\">)</mo><mtext> in general</mtext><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{apply}(s, op, k) = \\mathrm{apply}(s, op, k) \\quad\\text{and}\\quad\n\\mathrm{apply}(s, op, k_1) \\neq \\mathrm{apply}(s, op, k_2)\\ \\text{in general}.</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:1em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">1</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\"><span class=\"mrel\"><span class=\"mord vbox\"><span class=\"thinbox\"><span class=\"rlap\"><span class=\"strut\" style=\"height:0.8889em;vertical-align:-0.1944em;\"></span><span class=\"inner\"><span class=\"mord\"><span class=\"mrel\"></span></span></span><span class=\"fix\"></span></span></span></span></span><span class=\"mspace nobreak\"></span><span class=\"mrel\">=</span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">apply</span></span><span class=\"mopen\">(</span><span class=\"mord mathnormal\">s</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord mathnormal\">o</span><span class=\"mord mathnormal\">p</span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.03148em;\">k</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:-0.0315em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\">2</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\"> </span><span class=\"mord text\"><span class=\"mord\">in general</span></span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Prefer <em>monotonic</em> identifiers at boundaries (sequence numbers, epochs, version vectors) so that replays are detectable and order can be reasoned about.</p>\n<p>Crash points matter: define what happens if the process stops after each line that mutates state or acknowledges work.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Implementation is the act of making invalid state unrepresentable (or at least unignorable).</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Crash Consistency: Durable State Without Mysticism: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Make rollbacks safe: schema and protocol compatibility is a security boundary.</li>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Design playbooks as protocols: predictable steps, bounded risk, and clear ownership.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> <span class=\"citation\" id=\"citation--lamport1978--1\">(<a href=\"#bib-lamport1978\">1</a>)</span> — The mental model for causality and ordering in distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--2\">(<a href=\"#bib-rfc9110\">2</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-07-crash-consistency-durable-state-without-mysticism",
            "title": "Crash Consistency: Durable State Without Mysticism",
            "summary": "Engineering notebook entry (July 2016): Crash Consistency: Durable State Without Mysticism.",
            "date_modified": "2016-07-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-06-cryptographic-hygiene-domain-separation-kdfs-and-context-bin",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Cryptographic Hygiene: Domain Separation, KDFs, and Context Binding</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Separate durable state from derived state; derived must be recomputable or reconcilable.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Treat retries, reordering, and partial failure as default conditions.</li>\n<li>Automate guardrails; humans are for judgment, not for consistent enforcement.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>Correctness bugs are indistinguishable from security incidents when the system is adversarial.</li>\n<li>Correctness is a property you enforce at boundaries: parsing, persistence, concurrency, RPC.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>How do you ensure deduplication is scoped correctly (tenant, resource, operation)?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>Where do you need atomicity (and where is eventual consistency acceptable)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n<li>Requests can be duplicated, reordered, delayed, and replayed across restarts.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Letting recovery be “restart the service and hope.”</li>\n<li>Baking invariants into tribal knowledge instead of code.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Observability pipelines can be attacked (cardinality explosions, log injection). Protect them.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>We want a transition function <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>δ</mi></mrow><annotation encoding=\"application/x-tex\">\\delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span></span></span></span></span> and invariant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>δ</mi><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo separator=\"true\">,</mo><msub><mi>e</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mo>∧</mo><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_{t+1} = \\delta(s_t, e_t)\\qquad\\wedge\\qquad \\mathrm{Inv}(s_t)\\Rightarrow \\mathrm{Inv}(s_{t+1}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6389em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Treat invariants as a first-class interface: a function that cannot check its invariants cannot be safely composed. Start with the smallest invariant that is both meaningful and enforceable at your boundaries.</p>\n<p>Prefer <em>monotonic</em> identifiers at boundaries (sequence numbers, epochs, version vectors) so that replays are detectable and order can be reasoned about.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Make the “impossible state” observable: a metric or alert that fires when invariants drift.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Config drift that weakens security posture over time.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>A recovery plan that isn’t exercised will fail when you need it.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Implementation is the act of making invalid state unrepresentable (or at least unignorable).</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Correctness checklist:\n1) Define state (durable vs derived).\n2) Enumerate transitions.\n3) Write invariants (safety) and progress conditions (liveness).\n4) Pick crash points and specify recovery.\n5) Make retries part of semantics (idempotency keys, monotonic versions).</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Validate time assumptions: alert on clock steps, skew, and monotonicity issues.</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Fault injection and correctness testing for distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Fault injection and correctness testing for distributed systems.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-06-cryptographic-hygiene-domain-separation-kdfs-and-context-bin",
            "title": "Cryptographic Hygiene: Domain Separation, KDFs, and Context Binding",
            "summary": "Threat-model-first analysis (June 2016): Cryptographic Hygiene: Domain Separation, KDFs, and Context Binding.",
            "date_modified": "2016-06-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-05-threat-modeling-for-engineers-assumptions-as-interfaces",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Threat Modeling for Engineers: Assumptions as Interfaces</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Measure correctness signals, not only latency/throughput.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>Correctness bugs are indistinguishable from security incidents when the system is adversarial.</li>\n<li>Performance work that changes semantics is a correctness regression with a nicer latency chart.</li>\n<li>Your on-call runbook is part of the specification—make it match the code.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where do you need atomicity (and where is eventual consistency acceptable)?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “best effort” client behavior for safety properties.</li>\n<li>Letting recovery be “restart the service and hope.”</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common pattern is splitting state into durable vs derived:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>S</mi><mo>=</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo>×</mo><msub><mi>S</mi><mtext>derived</mtext></msub><mspace width=\"2em\"></mspace><mtext>and</mtext><mspace width=\"2em\"></mspace><msub><mi>S</mi><mtext>derived</mtext></msub><mo>=</mo><mi>f</mi><mo stretchy=\"false\">(</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">S = S_\\text{durable} \\times S_\\text{derived}\\qquad\\text{and}\\qquad S_\\text{derived} = f(S_\\text{durable}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Prefer <em>monotonic</em> identifiers at boundaries (sequence numbers, epochs, version vectors) so that replays are detectable and order can be reasoned about.</p>\n<p>Treat invariants as a first-class interface: a function that cannot check its invariants cannot be safely composed. Start with the smallest invariant that is both meaningful and enforceable at your boundaries.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Config drift that weakens security posture over time.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Implementation is the act of making invalid state unrepresentable (or at least unignorable).</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Idempotency sketch: reserve -> execute -> commit result (or return cached).</span>\n<span class=\"token keyword\">type</span> Key <span class=\"token builtin\">string</span>\n\n<span class=\"token keyword\">type</span> Store <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Get</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> ok <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n  <span class=\"token function\">PutIfAbsent</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">,</span> value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>stored <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Threat Modeling for Engineers: Assumptions as Interfaces: \"timeout\" must not mean \"try again and maybe double-apply\".</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n<li>Make rollbacks safe: schema and protocol compatibility is a security boundary.</li>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Make degraded modes explicit: fail closed vs fail open is a policy choice.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--2\">(<a href=\"#bib-rfc9110\">2</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-05-threat-modeling-for-engineers-assumptions-as-interfaces",
            "title": "Threat Modeling for Engineers: Assumptions as Interfaces",
            "summary": "Correctness-focused deep dive (May 2016): Threat Modeling for Engineers: Assumptions as Interfaces.",
            "date_modified": "2016-05-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-04-time-is-a-lie-clocks-causality-and-ordering",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Time Is a Lie: Clocks, Causality, and Ordering</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Write assumptions down; treat them as interfaces.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>Correctness is a property you enforce at boundaries: parsing, persistence, concurrency, RPC.</li>\n<li>Performance work that changes semantics is a correctness regression with a nicer latency chart.</li>\n<li>Your on-call runbook is part of the specification—make it match the code.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Concurrency is adversarial: races appear only in production schedules.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n<li>Deployments are mixed-version for longer than you think.</li>\n<li>Partial failure is normal: one replica slow, one unavailable, one returning stale data.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “best effort” client behavior for safety properties.</li>\n<li>Treating retries as a transport detail rather than a semantic constraint.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common pattern is splitting state into durable vs derived:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>S</mi><mo>=</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo>×</mo><msub><mi>S</mi><mtext>derived</mtext></msub><mspace width=\"2em\"></mspace><mtext>and</mtext><mspace width=\"2em\"></mspace><msub><mi>S</mi><mtext>derived</mtext></msub><mo>=</mo><mi>f</mi><mo stretchy=\"false\">(</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">S = S_\\text{durable} \\times S_\\text{derived}\\qquad\\text{and}\\qquad S_\\text{derived} = f(S_\\text{durable}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>If you can’t define what a timeout means, you can’t implement retries safely. Make ambiguity explicit in the API.</p>\n<p>Crash points matter: define what happens if the process stops after each line that mutates state or acknowledges work.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>If the system can enter an invalid state, it eventually will—usually during an incident.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Sampling hides the rare schedule that breaks your invariants.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Init\n  Init <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> bootstrap<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Ready <span class=\"token arrow operator\">--></span> Processing<span class=\"token operator\">:</span> event<span class=\"token text string\">(e)</span>\n  Processing <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> commit<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Processing <span class=\"token arrow operator\">--></span> Error<span class=\"token operator\">:</span> violate<span class=\"token text string\">(Inv)</span>\n  Error <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> recover<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Treat every boundary (RPC, DB, queue, cache) as a semantic interface with explicit contracts.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Acknowledge only after durability (or make “ack” explicitly best-effort).</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Time Is a Lie: Clocks, Causality, and Ordering: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> <span class=\"citation\" id=\"citation--kleppmann2017ddia--1\">(<a href=\"#bib-kleppmann2017ddia\">1</a>)</span> — The systems-engineering baseline for correctness, replication, and failure.\n<ul>\n<li><strong>Evidence:</strong> Replication and consistency tradeoffs as engineering constraints; use as reference when naming guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--2\">(<a href=\"#bib-jepsen\">2</a>)</span> — Failure testing focused on correctness under partitions and reordering.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/paxos-simple.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Paxos Made Simple (Lamport)</a> — A clean reference for agreement and invariants.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-kleppmann2017ddia\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Kleppmann M. Designing Data-Intensive Applications [Internet]. O’Reilly Media; 2017. Available from: https://dataintensive.net/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-04-time-is-a-lie-clocks-causality-and-ordering",
            "title": "Time Is a Lie: Clocks, Causality, and Ordering",
            "summary": "Adversarial-first deep dive (April 2016): Time Is a Lie: Clocks, Causality, and Ordering.",
            "date_modified": "2016-04-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-03-backpressure-as-a-correctness-property-stability-under-load",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Backpressure as a Correctness Property: Stability Under Load</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Correctness is cheaper to enforce at interfaces than to repair in production data.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Make retries semantic: idempotency keys, monotonic versions, and explicit ambiguity.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Design rollbacks as part of the happy path.</li>\n<li>Define safety properties before performance goals.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>Your on-call runbook is part of the specification—make it match the code.</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n<li>“Works in tests” often means “fails under reordering and retries.”</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>What must be durable before you acknowledge?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>Where do you need atomicity (and where is eventual consistency acceptable)?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Partial failure is normal: one replica slow, one unavailable, one returning stale data.</li>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n<li>Concurrency is adversarial: races appear only in production schedules.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Letting recovery be “restart the service and hope.”</li>\n<li>Treating retries as a transport detail rather than a semantic constraint.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Any unbounded work per request becomes a DoS primitive under adversaries.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>We want a transition function <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>δ</mi></mrow><annotation encoding=\"application/x-tex\">\\delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span></span></span></span></span> and invariant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>δ</mi><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo separator=\"true\">,</mo><msub><mi>e</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mo>∧</mo><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_{t+1} = \\delta(s_t, e_t)\\qquad\\wedge\\qquad \\mathrm{Inv}(s_t)\\Rightarrow \\mathrm{Inv}(s_{t+1}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6389em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Crash points matter: define what happens if the process stops after each line that mutates state or acknowledges work.</p>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">sequenceDiagram</span>\n  <span class=\"token keyword\">participant</span> C as Client\n  <span class=\"token keyword\">participant</span> API as API\n  <span class=\"token keyword\">participant</span> DB as Durable Store\n  C<span class=\"token arrow operator\">->></span>API<span class=\"token operator\">:</span> request<span class=\"token text string\">(op, idempotency_key)</span>\n  API<span class=\"token arrow operator\">->></span>DB<span class=\"token operator\">:</span> check_or_reserve<span class=\"token text string\">(key)</span>\n  DB<span class=\"token arrow operator\">-->></span>API<span class=\"token operator\">:</span> miss | hit<span class=\"token text string\">(result)</span>\n  API<span class=\"token arrow operator\">->></span>DB<span class=\"token operator\">:</span> commit<span class=\"token text string\">(result)</span>\n  API<span class=\"token arrow operator\">-->></span>C<span class=\"token operator\">:</span> ack<span class=\"token text string\">(result)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>The goal isn’t cleverness—it’s eliminating ambiguity at boundaries and making recovery boring.</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"rust\"><pre class=\"language-rust\"><code class=\"language-rust\"><span class=\"token keyword\">use</span> <span class=\"token namespace\">core<span class=\"token punctuation\">::</span></span>fmt<span class=\"token punctuation\">;</span>\n\n<span class=\"token attribute attr-name\">#[derive(Clone, Debug)]</span>\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">enum</span> <span class=\"token type-definition class-name\">Event</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token class-name\">Input</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">Vec</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">u8</span><span class=\"token operator\">></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Tick</span><span class=\"token punctuation\">,</span>\n    <span class=\"token class-name\">Fault</span><span class=\"token punctuation\">(</span><span class=\"token operator\">&#x26;</span><span class=\"token lifetime-annotation symbol\">'static</span> <span class=\"token keyword\">str</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">pub</span> <span class=\"token keyword\">trait</span> <span class=\"token type-definition class-name\">StateMachine</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">State</span><span class=\"token punctuation\">:</span> <span class=\"token class-name\">Clone</span> <span class=\"token operator\">+</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">type</span> <span class=\"token type-definition class-name\">Error</span><span class=\"token punctuation\">:</span> <span class=\"token namespace\">fmt<span class=\"token punctuation\">::</span></span><span class=\"token class-name\">Debug</span><span class=\"token punctuation\">;</span>\n\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">step</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> event<span class=\"token punctuation\">:</span> <span class=\"token class-name\">Event</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token class-name\">Result</span><span class=\"token operator\">&#x3C;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">,</span> <span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">Error</span><span class=\"token operator\">></span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">fn</span> <span class=\"token function-definition function\">invariant</span><span class=\"token punctuation\">(</span>state<span class=\"token punctuation\">:</span> <span class=\"token operator\">&#x26;</span><span class=\"token keyword\">Self</span><span class=\"token punctuation\">::</span><span class=\"token class-name\">State</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">-></span> <span class=\"token keyword\">bool</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Backpressure as a Correctness Property: Stability Under Load: invariants are part of the API contract.</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Differential tests</strong> against a reference model (even a slow one).</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Expose idempotency semantics explicitly (headers, keys, retention windows, error codes).</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Instrument ambiguity: measure “unknown outcome” responses separately from failures.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Keep audit and config history queryable during incidents—evidence beats intuition.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> <span class=\"citation\" id=\"citation--jepsen--1\">(<a href=\"#bib-jepsen\">1</a>)</span> — Failure testing focused on correctness under partitions and reordering.\n<ul>\n<li><strong>Evidence:</strong> Turn faults into test cases; prioritize partition and clock-skew scenarios that violate user-visible guarantees.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--2\">(<a href=\"#bib-rfc9110\">2</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>Which invariant, if violated, would silently corrupt state for weeks?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-jepsen\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Jepsen. Jepsen: Distributed Systems Safety Analysis [Internet]. Web; Available from: https://jepsen.io/</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-03-backpressure-as-a-correctness-property-stability-under-load",
            "title": "Backpressure as a Correctness Property: Stability Under Load",
            "summary": "Design memo (March 2016): Backpressure as a Correctness Property: Stability Under Load.",
            "date_modified": "2016-03-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-02-idempotency-everywhere-designing-safe-retries-in-distributed",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p><strong>Idempotency Everywhere: Designing Safe Retries in Distributed APIs</strong> as an engineering constraint: write down assumptions, make invariants executable, and design operational recovery as part of correctness.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>If the spec is implicit, the implementation becomes the spec—and you’ll learn it during incidents.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Separate durable state from derived state; derived must be recomputable or reconcilable.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Define safety properties before performance goals.</li>\n<li>Prefer protocols and APIs that make invalid states hard to express.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>“Works in tests” often means “fails under reordering and retries.”</li>\n<li>Undefined behavior is an attack surface when inputs are adversarial.</li>\n<li>If recovery is not specified, recovery becomes improvisation.</li>\n<li>A system without explicit contracts becomes a collection of folklore and dashboards.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n<li>Where does concurrency create “double spend” style failures in your domain?</li>\n<li>How do you make “unsafe defaults” impossible to ship?</li>\n<li>What must be durable before you acknowledge?</li>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Time is untrusted: clock skew, NTP steps, monotonic vs wall-clock confusion.</li>\n<li>Crashes happen mid-write (torn state) unless you prove otherwise.</li>\n<li>Input is hostile: malformed, oversized, boundary values, protocol confusion.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Baking invariants into tribal knowledge instead of code.</li>\n<li>Treating retries as a transport detail rather than a semantic constraint.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Parsing is an attacker-controlled interface—validate early and fail fast.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>A common pattern is splitting state into durable vs derived:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><mi>S</mi><mo>=</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo>×</mo><msub><mi>S</mi><mtext>derived</mtext></msub><mspace width=\"2em\"></mspace><mtext>and</mtext><mspace width=\"2em\"></mspace><msub><mi>S</mi><mtext>derived</mtext></msub><mo>=</mo><mi>f</mi><mo stretchy=\"false\">(</mo><msub><mi>S</mi><mtext>durable</mtext></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">S = S_\\text{durable} \\times S_\\text{derived}\\qquad\\text{and}\\qquad S_\\text{derived} = f(S_\\text{durable}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8333em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">×</span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:0.8444em;vertical-align:-0.15em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord text\"><span class=\"mord\">and</span></span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">derived</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.10764em;\">f</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\" style=\"margin-right:0.05764em;\">S</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3361em;\"><span style=\"top:-2.55em;margin-left:-0.0576em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord text mtight\"><span class=\"mord mtight\">durable</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>If you can’t define what a timeout means, you can’t implement retries safely. Make ambiguity explicit in the API.</p>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Invariants must be checkable from evidence you actually have (state + logs + counters).</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Evidence: critical actions emit verifiable audit events.</li>\n<li>Downgrade resistance: negotiation can’t silently weaken security posture.</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Config drift that weakens security posture over time.</li>\n<li>Timeout ambiguity causing double-apply or partial state transitions.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Mixed-version deployments create states you never tested—plan for them explicitly.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">stateDiagram-v2</span>\n  <span class=\"token text string\">[*]</span> <span class=\"token arrow operator\">--></span> Init\n  Init <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> bootstrap<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Ready <span class=\"token arrow operator\">--></span> Processing<span class=\"token operator\">:</span> event<span class=\"token text string\">(e)</span>\n  Processing <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> commit<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span>\n  Processing <span class=\"token arrow operator\">--></span> Error<span class=\"token operator\">:</span> violate<span class=\"token text string\">(Inv)</span>\n  Error <span class=\"token arrow operator\">--></span> Ready<span class=\"token operator\">:</span> recover<span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Implementation is the act of making invalid state unrepresentable (or at least unignorable).</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Make rollbacks boring: if rollback is a hero move, it will fail.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Correctness checklist:\n1) Define state (durable vs derived).\n2) Enumerate transitions.\n3) Write invariants (safety) and progress conditions (liveness).\n4) Pick crash points and specify recovery.\n5) Make retries part of semantics (idempotency keys, monotonic versions).</code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n<li><strong>Fuzzing</strong> at the boundary: parsers, schema evolution, and “unknown field” handling.</li>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Crash/restart tests</strong>: persist mid-transition and validate recovery correctness.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Validate time assumptions: alert on clock steps, skew, and monotonicity issues.</li>\n<li>Make rollbacks safe: schema and protocol compatibility is a security boundary.</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Error budget burn + tail latency under load.</li>\n<li>Retry/timeout rates by endpoint and client cohort.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> <span class=\"citation\" id=\"citation--lamport1978--1\">(<a href=\"#bib-lamport1978\">1</a>)</span> — The mental model for causality and ordering in distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> <span class=\"citation\" id=\"citation--rfc9110--2\">(<a href=\"#bib-rfc9110\">2</a>)</span> — Defines method semantics including idempotency and safety—useful for API contracts.\n<ul>\n<li><strong>Evidence:</strong> Method semantics (safe/idempotent) are contracts; tie retries and dedupe behavior to these semantics, not timeouts.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>Which operations need monotonic versioning vs idempotency keys vs both?</li>\n<li>What is the minimal durable record needed to recover safely?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-rfc9110\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Fielding RT, Nottingham M, Reschke J. HTTP Semantics [Internet]. RFC Editor; 2022. Report No.: 9110. Available from: https://www.rfc-editor.org/rfc/rfc9110</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-02-idempotency-everywhere-designing-safe-retries-in-distributed",
            "title": "Idempotency Everywhere: Designing Safe Retries in Distributed APIs",
            "summary": "Correctness-focused deep dive (February 2016): Idempotency Everywhere: Designing Safe Retries in Distributed APIs.",
            "date_modified": "2016-02-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        },
        {
            "id": "https://mayckongiovani.xyz/pensieve/2016-01-protocol-state-machines-invariants-events-and-recovery",
            "content_html": "<blockquote>\n<p>Monthly research note. Theme: <strong>Correctness &#x26; Foundations</strong>.</p>\n</blockquote>\n<h2 id=\"tldr\" style=\"position:relative;\"><a href=\"#tldr\" aria-label=\"tldr permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>TL;DR</h2>\n<p>A focused memo on <strong>Protocol State Machines: Invariants, Events, and Recovery</strong>: define the model, state the properties, then design the system so those properties remain true under failure and adversaries.</p>\n<div class=\"callout callout--key-insight\">\n  <div class=\"callout-title\">Key insight</div>\n  <p>Treat “timeouts” as a third outcome: not success, not failure—ambiguity you must model.</p>\n</div>\n<h2 id=\"key-takeaways\" style=\"position:relative;\"><a href=\"#key-takeaways\" aria-label=\"key takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key takeaways</h2>\n<ul>\n<li>Ack semantics must be explicit: durable, best-effort, or ambiguous.</li>\n<li>Prefer monotonic counters/epochs over wall-clock timestamps at correctness boundaries.</li>\n<li>Crash points are part of the design; specify recovery after each state mutation.</li>\n<li>Make failure modes explicit and observable.</li>\n<li>Design rollbacks as part of the happy path.</li>\n</ul>\n<h2 id=\"why-this-matters\" style=\"position:relative;\"><a href=\"#why-this-matters\" aria-label=\"why this matters permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Why this matters</h2>\n<ul>\n<li>In distributed code, retries and duplication are the common case—not the edge case.</li>\n<li>If recovery is not specified, recovery becomes improvisation.</li>\n<li>The cost of unclear invariants is paid in production, under load, during an incident.</li>\n<li>Correctness is a property you enforce at boundaries: parsing, persistence, concurrency, RPC.</li>\n</ul>\n<h2 id=\"key-questions\" style=\"position:relative;\"><a href=\"#key-questions\" aria-label=\"key questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key questions</h2>\n<ul>\n<li>Which invariants must hold across crashes, restarts, and partial deployments?</li>\n<li>Which transitions are allowed, and which are impossible by construction?</li>\n<li>What must be durable before you acknowledge?</li>\n<li>What is your ordering model: FIFO per key, per partition, or none at all?</li>\n<li>What <em>exactly</em> is the state, and what is derived or cached?</li>\n<li>What does a client learn after a timeout: success, failure, or ambiguity?</li>\n</ul>\n<h2 id=\"assumptions\" style=\"position:relative;\"><a href=\"#assumptions\" aria-label=\"assumptions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Assumptions</h2>\n<ul>\n<li>Errors are lossy: transient vs permanent is often indistinguishable at the boundary.</li>\n<li>Observability is incomplete: you will debug from partial evidence.</li>\n<li>Clients retry with backoff but not with perfect discipline (bursts happen).</li>\n<li>Partial failure is normal: one replica slow, one unavailable, one returning stale data.</li>\n</ul>\n<h2 id=\"non-goals\" style=\"position:relative;\"><a href=\"#non-goals\" aria-label=\"non goals permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Non-goals</h2>\n<ul>\n<li>Relying on “best effort” client behavior for safety properties.</li>\n<li>Baking invariants into tribal knowledge instead of code.</li>\n</ul>\n<div class=\"callout callout--attack-surface\">\n  <div class=\"callout-title\">Attack surface</div>\n  <p>Negotiation and fallbacks are where security silently becomes optional—treat them as hostile.</p>\n</div>\n<h2 id=\"model--invariants\" style=\"position:relative;\"><a href=\"#model--invariants\" aria-label=\"model  invariants permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Model &#x26; invariants</h2>\n<p>We want a transition function <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi>δ</mi></mrow><annotation encoding=\"application/x-tex\">\\delta</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6944em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span></span></span></span></span> and invariant <span class=\"math math-inline\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\"><semantics><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><annotation encoding=\"application/x-tex\">\\mathrm{Inv}</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6833em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span></span></span></span></span> such that:</p>\n<div class=\"math math-display\"><span class=\"katex-display\"><span class=\"katex\"><span class=\"katex-mathml\"><math xmlns=\"http://www.w3.org/1998/Math/MathML\" display=\"block\"><semantics><mrow><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo>=</mo><mi>δ</mi><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo separator=\"true\">,</mo><msub><mi>e</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mspace width=\"2em\"></mspace><mo>∧</mo><mspace width=\"2em\"></mspace><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mi>t</mi></msub><mo stretchy=\"false\">)</mo><mo>⇒</mo><mrow><mi mathvariant=\"normal\">I</mi><mi mathvariant=\"normal\">n</mi><mi mathvariant=\"normal\">v</mi></mrow><mo stretchy=\"false\">(</mo><msub><mi>s</mi><mrow><mi>t</mi><mo>+</mo><mn>1</mn></mrow></msub><mo stretchy=\"false\">)</mo><mi mathvariant=\"normal\">.</mi></mrow><annotation encoding=\"application/x-tex\">s_{t+1} = \\delta(s_t, e_t)\\qquad\\wedge\\qquad \\mathrm{Inv}(s_t)\\Rightarrow \\mathrm{Inv}(s_{t+1}).</annotation></semantics></math></span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"strut\" style=\"height:0.6389em;vertical-align:-0.2083em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">=</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord mathnormal\" style=\"margin-right:0.03785em;\">δ</span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mpunct\">,</span><span class=\"mspace\" style=\"margin-right:0.1667em;\"></span><span class=\"mord\"><span class=\"mord mathnormal\">e</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span><span class=\"mbin\">∧</span><span class=\"mspace\" style=\"margin-right:2em;\"></span><span class=\"mspace\" style=\"margin-right:0.2222em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2806em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t</span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.15em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span><span class=\"mrel\">⇒</span><span class=\"mspace\" style=\"margin-right:0.2778em;\"></span></span><span class=\"base\"><span class=\"strut\" style=\"height:1em;vertical-align:-0.25em;\"></span><span class=\"mord\"><span class=\"mord mathrm\" style=\"margin-right:0.01389em;\">Inv</span></span><span class=\"mopen\">(</span><span class=\"mord\"><span class=\"mord mathnormal\">s</span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.3011em;\"><span style=\"top:-2.55em;margin-left:0em;margin-right:0.05em;\"><span class=\"pstrut\" style=\"height:2.7em;\"></span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t</span><span class=\"mbin mtight\">+</span><span class=\"mord mtight\">1</span></span></span></span></span><span class=\"vlist-s\">​</span></span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height:0.2083em;\"><span></span></span></span></span></span></span><span class=\"mclose\">)</span><span class=\"mord\">.</span></span></span></span></span></div>\n<p>Avoid “ghost state” in caches that can’t be recomputed or validated. Derived state must be either reproducible or explicitly reconciled.</p>\n<p>Prefer <em>monotonic</em> identifiers at boundaries (sequence numbers, epochs, version vectors) so that replays are detectable and order can be reasoned about.</p>\n<div class=\"callout callout--invariant\">\n  <div class=\"callout-title\">Invariant</div>\n  <p>Monotonicity beats timestamps: counters and epochs survive clock skew.</p>\n</div>\n<h2 id=\"security-properties\" style=\"position:relative;\"><a href=\"#security-properties\" aria-label=\"security properties permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security properties</h2>\n<ul>\n<li>Integrity: invalid transitions are rejected (and detectable).</li>\n<li>Least authority: privileges are scoped by purpose and time.</li>\n<li>Replay resistance: duplicated inputs do not change outcomes.</li>\n<li>Authenticity: actions are bound to identity and purpose.</li>\n</ul>\n<h2 id=\"failure-modes\" style=\"position:relative;\"><a href=\"#failure-modes\" aria-label=\"failure modes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Failure modes</h2>\n<ul>\n<li>Mixed-version behavior that violates assumptions silently.</li>\n<li>Resource exhaustion (CPU/bandwidth/storage) turning into correctness failures.</li>\n<li>Recovery paths that only work when nothing is broken.</li>\n<li>Observability gaps during incidents (missing evidence).</li>\n</ul>\n<div class=\"callout callout--pitfall\">\n  <div class=\"callout-title\">Pitfall</div>\n  <p>Caches tend to become sources of truth unless you can recompute and validate them.</p>\n</div>\n<h2 id=\"design-sketch\" style=\"position:relative;\"><a href=\"#design-sketch\" aria-label=\"design sketch permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Design sketch</h2>\n<div class=\"gatsby-highlight\" data-language=\"mermaid\"><pre class=\"language-mermaid\"><code class=\"language-mermaid\"><span class=\"token keyword\">flowchart</span> TD\n  input<span class=\"token text string\">[\"Input\"]</span> <span class=\"token arrow operator\">--></span> parse<span class=\"token text string\">[\"Parse/Validate\"]</span>\n  parse <span class=\"token arrow operator\">--></span> decide<span class=\"token text string\">[\"Decide (pure)\"]</span>\n  decide <span class=\"token arrow operator\">--></span> write<span class=\"token text string\">[\"Durable write\"]</span>\n  write <span class=\"token arrow operator\">--></span> ack<span class=\"token text string\">[\"Acknowledge\"]</span>\n  ack <span class=\"token arrow operator\">--></span> obs<span class=\"token text string\">[\"Emit evidence (logs/metrics)\"]</span></code></pre></div>\n<h2 id=\"implementation-notes\" style=\"position:relative;\"><a href=\"#implementation-notes\" aria-label=\"implementation notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Implementation notes</h2>\n<p>Implementation is the act of making invalid state unrepresentable (or at least unignorable).</p>\n<div class=\"callout callout--rule-of-thumb\">\n  <div class=\"callout-title\">Rule of thumb</div>\n  <p>Bound work per request: parse, validate, and cap cost before you allocate heavy resources.</p>\n</div>\n<div class=\"gatsby-highlight\" data-language=\"go\"><pre class=\"language-go\"><code class=\"language-go\"><span class=\"token comment\">// Idempotency sketch: reserve -> execute -> commit result (or return cached).</span>\n<span class=\"token keyword\">type</span> Key <span class=\"token builtin\">string</span>\n\n<span class=\"token keyword\">type</span> Store <span class=\"token keyword\">interface</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">Get</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">,</span> ok <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n  <span class=\"token function\">PutIfAbsent</span><span class=\"token punctuation\">(</span>key Key<span class=\"token punctuation\">,</span> value <span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token builtin\">byte</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">(</span>stored <span class=\"token builtin\">bool</span><span class=\"token punctuation\">,</span> err <span class=\"token builtin\">error</span><span class=\"token punctuation\">)</span>\n<span class=\"token punctuation\">}</span>\n\n<span class=\"token comment\">// Protocol State Machines: Invariants, Events, and Recovery: \"timeout\" must not mean \"try again and maybe double-apply\".</span></code></pre></div>\n<h2 id=\"verification-strategy\" style=\"position:relative;\"><a href=\"#verification-strategy\" aria-label=\"verification strategy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Verification strategy</h2>\n<ul>\n<li><strong>Metamorphic tests</strong>: same operation applied twice must not change the result.</li>\n<li><strong>Fault injection</strong>: latency, partial writes, dropped acks, and duplicated messages.</li>\n<li><strong>Invariant monitoring</strong> in prod: encode safety properties as metrics (rate of impossible states).</li>\n<li><strong>Property-based tests</strong>: generate adversarial sequences and assert invariants after every step.</li>\n<li><strong>Deterministic schedulers</strong> (e.g., Loom-like) to force rare interleavings.</li>\n</ul>\n<h2 id=\"operational-notes\" style=\"position:relative;\"><a href=\"#operational-notes\" aria-label=\"operational notes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Operational notes</h2>\n<ul>\n<li>Run chaos drills focused on state: partial DB outages, replica lag, cache poisoning.</li>\n<li>Track invariant violations as pages, not dashboards.</li>\n<li>Validate time assumptions: alert on clock steps, skew, and monotonicity issues.</li>\n<li>Design “degraded modes” explicitly (fail closed vs fail open per operation).</li>\n<li>Log as evidence: append-only where possible; isolate logs from compromised workloads.</li>\n</ul>\n<div class=\"callout callout--operational-note\">\n  <div class=\"callout-title\">Operational note</div>\n  <p>Attach explicit rollout/rollback triggers to changes that touch security or correctness.</p>\n</div>\n<h2 id=\"what-to-monitor\" style=\"position:relative;\"><a href=\"#what-to-monitor\" aria-label=\"what to monitor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What to monitor</h2>\n<ul>\n<li>Error budget burn + tail latency under load.</li>\n<li>Rollback events and the conditions that triggered them.</li>\n<li>Authz failures and policy denials (unexpected spikes).</li>\n<li>Invariant violation rate (should be ~0).</li>\n<li>Admission-control / rate-limit rejections (by reason).</li>\n</ul>\n<h2 id=\"rollback-plan\" style=\"position:relative;\"><a href=\"#rollback-plan\" aria-label=\"rollback plan permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Rollback plan</h2>\n<ul>\n<li>Prefer backward-compatible changes; avoid “flag day” upgrades.</li>\n<li>Preserve evidence (configs, artifacts, audit logs) to reconstruct what changed.</li>\n<li>Use canaries and staged rollout; stop early when signals degrade.</li>\n<li>Keep dual-write / dual-verify windows where appropriate.</li>\n<li>Define an explicit rollback trigger (metrics + thresholds).</li>\n</ul>\n<h2 id=\"evidence\" style=\"position:relative;\"><a href=\"#evidence\" aria-label=\"evidence permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Evidence</h2>\n<ul>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> <span class=\"citation\" id=\"citation--lamport1978--1\">(<a href=\"#bib-lamport1978\">1</a>)</span> — The mental model for causality and ordering in distributed systems.\n<ul>\n<li><strong>Evidence:</strong> Use this as the baseline for happens-before vs wall-clock; avoid embedding clock assumptions into safety properties.</li>\n</ul>\n</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> <span class=\"citation\" id=\"citation--beyer2016sre--2\">(<a href=\"#bib-beyer2016sre\">2</a>)</span> — Error budgets, incident response, and reliability as an engineering discipline.\n<ul>\n<li><strong>Evidence:</strong> Error budgets and incident response are correctness controls; tie monitoring and rollback triggers to SLO burn.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"open-questions\" style=\"position:relative;\"><a href=\"#open-questions\" aria-label=\"open questions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Open questions</h2>\n<ul>\n<li>What is the minimal durable record needed to recover safely?</li>\n<li>What would you do if you had to replay a month of traffic into a rebuilt system?</li>\n<li>Where does your API currently allow ambiguous outcomes, and how will clients cope?</li>\n<li>Which correctness properties can be enforced at compile time (types/capabilities)?</li>\n</ul>\n<h2 id=\"checklist\" style=\"position:relative;\"><a href=\"#checklist\" aria-label=\"checklist permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Checklist</h2>\n<ul class=\"contains-task-list\">\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Failure modes enumerated with mitigations.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Rollback plan rehearsed and automated.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Safety properties stated as invariants.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Telemetry captures correctness signals.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Assumptions listed and reviewed.</li>\n<li class=\"task-list-item\"><input type=\"checkbox\" disabled> Costs bounded (CPU/memory/bandwidth) under adversarial inputs.</li>\n</ul>\n<h2 id=\"further-reading\" style=\"position:relative;\"><a href=\"#further-reading\" aria-label=\"further reading permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Further reading</h2>\n<ul>\n<li><a href=\"https://jepsen.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jepsen</a> — Failure testing focused on correctness under partitions and reordering.</li>\n<li><a href=\"https://learntla.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Learn TLA+</a> — A pragmatic workflow for invariants and model checking.</li>\n<li><a href=\"https://lamport.azurewebsites.net/pubs/time-clocks.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Time, Clocks, and the Ordering of Events (Lamport, 1978)</a> — The mental model for causality and ordering in distributed systems.</li>\n<li><a href=\"https://www.rfc-editor.org/rfc/rfc9110\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC 9110: HTTP Semantics</a> — Defines method semantics including idempotency and safety—useful for API contracts.</li>\n<li><a href=\"https://sre.google/sre-book/table-of-contents/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Site Reliability Engineering (Google)</a> — Error budgets, incident response, and reliability as an engineering discipline.</li>\n<li><a href=\"https://dataintensive.net/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Designing Data-Intensive Applications (Kleppmann)</a> — The systems-engineering baseline for correctness, replication, and failure.</li>\n</ul><div id=\"refs\" class=\"references csl-bib-body\">\n  <div class=\"csl-entry\" id=\"bib-lamport1978\">\n    <div class=\"csl-left-margin\">1. </div><div class=\"csl-right-inline\">Lamport L. Time, Clocks, and the Ordering of Events in a Distributed System. Communications of the ACM [Internet]. 1978;21(7):558–65. Available from: https://lamport.azurewebsites.net/pubs/time-clocks.pdf</div>\n  </div>\n  <div class=\"csl-entry\" id=\"bib-beyer2016sre\">\n    <div class=\"csl-left-margin\">2. </div><div class=\"csl-right-inline\">Beyer B, Jones C, Petoff J, Murphy NR. Site Reliability Engineering: How Google Runs Production Systems [Internet]. O’Reilly Media; 2016. Available from: https://sre.google/sre-book/table-of-contents/</div>\n  </div>\n</div>",
            "url": "https://mayckongiovani.xyz/pensieve/2016-01-protocol-state-machines-invariants-events-and-recovery",
            "title": "Protocol State Machines: Invariants, Events, and Recovery",
            "summary": "Design memo (January 2016): Protocol State Machines: Invariants, Events, and Recovery.",
            "date_modified": "2016-01-01T00:00:00.000Z",
            "tags": [
                "research-notes",
                "protocol-design",
                "correctness",
                "formal-methods",
                "Rust"
            ]
        }
    ]
}