<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Stanislav Sysoiev</title>
    <description>The latest articles on DEV Community by Stanislav Sysoiev (@sysstas).</description>
    <link>https://dev.to/sysstas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F270981%2F3b6b0014-7e2c-4ccd-8a24-2bdec107a6f0.png</url>
      <title>DEV Community: Stanislav Sysoiev</title>
      <link>https://dev.to/sysstas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sysstas"/>
    <language>en</language>
    <item>
      <title>Encrypting backups with a key we never hold: the design, and what it doesn't protect</title>
      <dc:creator>Stanislav Sysoiev</dc:creator>
      <pubDate>Thu, 19 Nov 2026 14:49:23 +0000</pubDate>
      <link>https://dev.to/sysstas/encrypting-backups-with-a-key-we-never-hold-the-design-and-what-it-doesnt-protect-12a7</link>
      <guid>https://dev.to/sysstas/encrypting-backups-with-a-key-we-never-hold-the-design-and-what-it-doesnt-protect-12a7</guid>
      <description>&lt;p&gt;"Encrypted at rest" usually means the provider encrypts your data with a key the provider holds. That protects against a stolen disk. It doesn't answer the question a customer actually asks a backup service: &lt;em&gt;can you read my backups?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I build BackupLatte, a backup service for Linear and ClickUp. This month we shipped an option to seal stored backups with a key only the customer holds. Here is how it's designed, what we had to give up, a bug it caused that had nothing to do with cryptography, and the list of things it does not protect.&lt;/p&gt;

&lt;h2&gt;
  
  
  The constraint: backups run while nobody is watching
&lt;/h2&gt;

&lt;p&gt;Backups run on a schedule, at 2 a.m., with no one at a keyboard. So the server must be able to &lt;em&gt;encrypt&lt;/em&gt; without the customer, but must not be able to &lt;em&gt;decrypt&lt;/em&gt; later.&lt;/p&gt;

&lt;p&gt;That points to envelope encryption with an asymmetric key:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The customer adds an &lt;strong&gt;RSA public key&lt;/strong&gt; (3072 bits or more, exponent 65537). The private key stays with them.&lt;/li&gt;
&lt;li&gt;Every backup run gets a fresh random 256-bit &lt;strong&gt;data key&lt;/strong&gt;. The data is encrypted with it.&lt;/li&gt;
&lt;li&gt;The data key is stored only &lt;strong&gt;wrapped&lt;/strong&gt;: encrypted with RSA-OAEP (SHA-256, MGF1-SHA-256, empty label) for each of the account's active public keys.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An account can hold up to three active keys, and every data key is wrapped for all of them. That makes a spare key cheap: generate a second pair, put the private half somewhere offline, and either key opens every backup.&lt;/p&gt;

&lt;p&gt;We stuck to boring, interoperable parameters on purpose. A wrapped data key opens with plain OpenSSL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl pkeyutl -decrypt -inkey private-key.pem \
  -pkeyopt rsa_padding_mode:oaep \
  -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256 \
  -in wrapped.bin -out data-key.bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next to the wraps, the server stores a &lt;strong&gt;key check value&lt;/strong&gt;: the first 16 bytes of HMAC-SHA-256 with the data key as the key and a fixed label as the message. It reveals nothing useful about the key. Its only job comes later, when a browser sends a data key back and the server needs to know it's the right one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The object format: chunked AES-GCM
&lt;/h2&gt;

&lt;p&gt;A snapshot can be large, and the worker streams it from the platform API to object storage. A single AES-GCM stream is authenticated only at its very end, so a reader would have to either buffer the whole object or act on data it hasn't verified yet. So every stored object is a sequence of separately authenticated chunks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;offset  size  field
0       4     magic "BLE1"
4       1     version = 1
5       16    data key id
21      32    random salt
53      4     chunk size (65536)
57      …     chunks: AES-256-GCM ciphertext || 16-byte tag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Each object gets its own key: HKDF-SHA-256 of the data key with that object's random salt.&lt;/li&gt;
&lt;li&gt;Because the key is unique per object, chunk nonces can be plain counters. The nonce is an 11-byte big-endian chunk counter followed by one byte that is &lt;code&gt;1&lt;/code&gt; for the last chunk and &lt;code&gt;0&lt;/code&gt; otherwise. This is the STREAM construction that tools like age use.&lt;/li&gt;
&lt;li&gt;The 57-byte header is the associated data of every chunk.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;chunkNonce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;nonce&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;alloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeUIntBE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;counter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// counter in the first 11 bytes, big-endian&lt;/span&gt;
  &lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeUInt8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Swapping, reordering, repeating or dropping chunks fails authentication, and so does editing the header. The last-chunk flag catches truncation: cut the object at a chunk boundary and the new final chunk was sealed with a "not last" nonce. A damaged object is an error, never silent garbage. Memory use is one chunk whatever the object size, and the overhead is a 57-byte header plus 16 bytes per 64 KiB.&lt;/p&gt;

&lt;p&gt;Two details that are easy to get wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compress before you encrypt.&lt;/strong&gt; Datasets are gzipped first, then sealed. The sealed object is stored as &lt;code&gt;application/octet-stream&lt;/code&gt; with no &lt;code&gt;Content-Encoding&lt;/code&gt;, otherwise an S3 client may helpfully try to gunzip ciphertext.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't sniff the magic bytes.&lt;/strong&gt; Whether an object is sealed is recorded in the database, not guessed from its first four bytes. Customers' copied files are arbitrary, and one of them can start with &lt;code&gt;BLE1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Restoring without sending the private key to the server
&lt;/h2&gt;

&lt;p&gt;A restore has to write plain data back into Linear or ClickUp, so the server needs the plaintext at some point. What it never needs is the private key. The unlock goes like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The customer picks their private key file in the browser. Unencrypted PEM goes straight into WebCrypto. A passphrase-protected key, or the legacy OpenSSL 1.x format, needs MD5 and 3DES or AES-CBC, which WebCrypto doesn't have, so &lt;code&gt;node-forge&lt;/code&gt; is loaded only for that case.&lt;/li&gt;
&lt;li&gt;The key is imported as a non-extractable &lt;code&gt;CryptoKey&lt;/code&gt; that can only decrypt.&lt;/li&gt;
&lt;li&gt;The browser asks for the wraps of the data keys &lt;em&gt;this one snapshot&lt;/em&gt; needs: the snapshot's own key, plus the keys of earlier runs whose copied files it references. It unwraps them locally.&lt;/li&gt;
&lt;li&gt;It sends the unwrapped data keys, never the private key. The server checks each against its key check value and keeps them, encrypted under a separate server-derived key, with an expiry: 72 hours for a restore, 24 hours for an export.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The expiry is a usability decision. A restore into Linear can stop halfway for reasons outside our control: Linear is unavailable for a while, or access is revoked mid-run. Asking for the key again on every resume would be miserable, while keeping the keys forever would quietly undo the point of the feature.&lt;/p&gt;

&lt;p&gt;Two guard rails on the way in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Proof of possession.&lt;/strong&gt; When a public key is added, the server wraps a random 32-byte challenge for it and the browser has to open it. Without this step, a pasted public key with a typo, or someone else's key, would make every future backup unreadable, and nobody would notice until a restore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"I saved it" is checked, not trusted.&lt;/strong&gt; If the browser generates the key pair (RSA-OAEP 4096 through WebCrypto), it downloads the private key and then asks the customer to select that file again before encryption can be switched on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Changing keys works the same way. A new key seals new backups immediately. To let it open older snapshots, the browser unwraps their data keys with an old private key and wraps them again for the new public key. Only the small wraps change, and the snapshots themselves aren't rewritten.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we gave up
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Incremental collection.&lt;/strong&gt; Some Linear datasets, like issue history and document versions, used to carry unchanged records over from the previous snapshot instead of fetching them again. With encryption on, the server can't read the previous snapshot. Any server-side cache that would bring the optimization back is, by definition, data the server can read. So for encrypted accounts those datasets are collected in full every day, and large workspaces back up more slowly. We documented that rather than working around it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content features.&lt;/strong&gt; Anything that reads snapshot content on the server, such as content tools for AI clients, can't work on sealed snapshots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A short window of server-held keys during a run.&lt;/strong&gt; A backup can span several segments and retries, and a retry has to read the shards already written. So while a run is in flight its data key is also stored under a server-derived key. The copy is deleted when the snapshot commits. After a failed run it stays for at least 24 hours, until a cleanup job finds no retry that still needs it, so a retry can continue from its checkpoint instead of starting over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting data out: a ZIP inside a ZIP
&lt;/h2&gt;

&lt;p&gt;Customers need their data in a form they can open without us. An encrypted snapshot leaves only as a ZIP protected with AES-256 (WinZip AE-2), with a password generated in the browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;ALPHABET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 32 symbols: no 0/O, no 1/I&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getRandomValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;ALPHABET&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's 28 × 5 = 140 random bits. &lt;code&gt;b &amp;amp; 31&lt;/code&gt; doesn't bias the result, because 256 is a multiple of 32.&lt;/p&gt;

&lt;p&gt;There's a catch in the ZIP format: it encrypts the &lt;em&gt;contents&lt;/em&gt; of entries but not their &lt;em&gt;names&lt;/em&gt;. A plain export lists names like &lt;code&gt;data/issues.json&lt;/code&gt; and one file per attachment. So the protected ZIP holds a single entry, &lt;code&gt;backuplatte-snapshot.zip&lt;/code&gt;, which is the normal export stored whole. Without the password, that one name is all you see.&lt;/p&gt;

&lt;p&gt;The ZIP format itself has a usability cost, too. The archive tools built into Windows and macOS can list an AES-encrypted entry but can't open it. The app tells people to use 7-Zip, Keka or &lt;code&gt;7z&lt;/code&gt; before the download starts. Otherwise the first support question would be "your ZIP is broken".&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that had nothing to do with cryptography
&lt;/h2&gt;

&lt;p&gt;On staging, the first real encrypted export failed three times in a row with &lt;code&gt;ETIMEDOUT&lt;/code&gt; while talking to object storage.&lt;/p&gt;

&lt;p&gt;The cause was Node's Happy Eyeballs. When a hostname resolves to several addresses, Node tries them in turn, giving each attempt 250 ms by default. That timer runs on the event loop. Our worker container is limited to half a CPU, and sealing the ZIP blocked the event loop for one to two seconds at a time. When the loop came back, the 250 ms timer had already fired and the connection was dropped, even though it had actually succeeded. The IPv6 fallback then failed immediately, because the host has no IPv6. The request ended with an &lt;code&gt;AggregateError&lt;/code&gt; whose message was an empty string, so our failure log said nothing at all.&lt;/p&gt;

&lt;p&gt;The fix was one line at startup in the API and the worker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;setDefaultAutoSelectFamilyAttemptTimeout&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'node:net'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;setDefaultAutoSelectFamilyAttemptTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A real connection failure still errors immediately, and an address that doesn't answer still falls through to the next one. We also started naming errors with empty messages by their code instead of storing an empty string. The general lesson: CPU-heavy work on the event loop doesn't only slow your own code down. It can break timers in code you never think about, like the socket connect inside an HTTP client.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't protect
&lt;/h2&gt;

&lt;p&gt;This is the part I'd want to read first if I were evaluating someone else's service.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The live workspace.&lt;/strong&gt; To make backups, the service holds OAuth tokens that can read and write the live Linear or ClickUp workspace. Someone who fully compromises the server gets those, whatever happens to the backups. Every backup service has the same problem, and encrypting the backups doesn't change it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data in flight.&lt;/strong&gt; During a backup, the server sees the data, because it reads it from the platform API itself. During a restore or export the customer unlocked, it sees the snapshot until the operation ends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The page that reads the key.&lt;/strong&gt; The private key is parsed by app.backuplatte.com's own JavaScript. The app's Content Security Policy allows scripts only from its own origin and from Paddle, the payment provider, but a compromised frontend could still steal the key. That holds for any design where a web page handles the key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metadata.&lt;/strong&gt; The account email, workspace names and settings, snapshot dates, sizes and record counts, file checksums, types and sizes, error messages from the platform, and the record of what a restore created all stay readable. The service needs them to run, to show usage, and to resume restores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lost keys.&lt;/strong&gt; If every private key on an account is lost, the encrypted backups are gone for good. We can't help, because we never had the key. A spare key kept offline is the only protection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So this isn't "zero-knowledge", and we don't call it that. What it does give you: the stored copies of your Linear and ClickUp data, the thing that sits in a bucket for a year, open only with a key you hold.&lt;/p&gt;

&lt;p&gt;The customer-facing side, including setup, key rotation, and the full list of what stays unencrypted, is in the &lt;a href="https://backuplatte.com/docs/encryption?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=own_key_encryption" rel="noopener noreferrer"&gt;encryption guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you've built customer-held-key encryption for a SaaS product, I'd like to hear how you handled the parts we found hardest: incremental work that needs the previous copy, and resuming long jobs without keeping keys around for too long.&lt;/p&gt;

</description>
      <category>security</category>
      <category>node</category>
      <category>cryptography</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Before your AI agent edits Linear, test how you will recover</title>
      <dc:creator>Stanislav Sysoiev</dc:creator>
      <pubDate>Sat, 14 Nov 2026 20:19:28 +0000</pubDate>
      <link>https://dev.to/sysstas/before-your-ai-agent-edits-linear-test-how-you-will-recover-17cl</link>
      <guid>https://dev.to/sysstas/before-your-ai-agent-edits-linear-test-how-you-will-recover-17cl</guid>
      <description>&lt;p&gt;“Clean up the backlog” sounds like a small task until you have to define &lt;em&gt;clean&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Does an issue with no updates for six months need closing? What if it describes a security problem? Are two similar titles duplicates if they affect different customers? Can an agent shorten a description without dropping the one reproduction step that matters?&lt;/p&gt;

&lt;p&gt;Imagine an agent closes 40 issues and rewrites 12 descriptions. Some changes are useful. Others are wrong. Meanwhile, a teammate adds a comment and updates an assignee.&lt;/p&gt;

&lt;p&gt;Now you need to recover the wrong changes while keeping the useful ones and your teammate's work.&lt;/p&gt;

&lt;p&gt;That's a hypothetical example, but it's the question I would answer before enabling bulk edits. I build BackupLatte, a backup service for Linear and ClickUp, so my interest here is also practical: what can you actually recover after a tool has changed your data?&lt;/p&gt;

&lt;h2&gt;
  
  
  Start with a proposal you can inspect
&lt;/h2&gt;

&lt;p&gt;For a first run, give the agent a task that ends with a proposed change list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Review open issues in the ENG team that have not been updated
in the last 180 days. Do not modify anything.

For each candidate, show:
- the issue identifier and URL
- its current status
- the proposed status
- the evidence for making that change
- anything that makes the decision uncertain

Exclude issues in active projects and issues with unresolved
dependencies. List possible duplicates separately; do not merge
or delete them. Return at most 10 candidates, then stop.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact rules should come from your team. The useful part is that you can inspect individual decisions before they become writes.&lt;/p&gt;

&lt;p&gt;For that initial review, enforce read-only access in the connection. Linear offers an MCP endpoint at &lt;code&gt;https://mcp.linear.app/mcp/readonly&lt;/code&gt; that exposes only read tools. Its standard endpoint can also be used with only the &lt;code&gt;read&lt;/code&gt; OAuth scope. &lt;a href="https://linear.app/docs/mcp" rel="noopener noreferrer"&gt;Linear's MCP documentation&lt;/a&gt; describes both options.&lt;/p&gt;

&lt;p&gt;A sentence saying “do not modify anything” helps communicate intent. A read-only connection also prevents a write if the agent gets that instruction wrong. Check for other connected tools or credentials that could still give it write access.&lt;/p&gt;

&lt;p&gt;When you enable writes, keep the permissions narrow. Linear personal API keys can be restricted by permission and team. For an OAuth integration that only posts comments, &lt;code&gt;comments:create&lt;/code&gt; is available instead of broad &lt;code&gt;write&lt;/code&gt; access. These are different connection mechanisms; check the one your agent actually uses. &lt;a href="https://linear.app/docs/api-and-webhooks" rel="noopener noreferrer"&gt;API keys&lt;/a&gt; · &lt;a href="https://linear.app/developers/oauth-2-0-authentication" rel="noopener noreferrer"&gt;OAuth scopes&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Approve specific changes, then check that they are still current
&lt;/h2&gt;

&lt;p&gt;“Those suggestions look good” is a weak handoff if the next run searches the backlog again and generates a different list.&lt;/p&gt;

&lt;p&gt;Keep a record of the approved operations. For a status change, it could look like this illustrative record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"issue"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ENG-142"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"field"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"before"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Backlog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"after"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Canceled"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Superseded by ENG-201; confirmed by the owner"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a review record, not a Linear API request. An executor would resolve and use the actual issue and workflow-state IDs.&lt;/p&gt;

&lt;p&gt;Before applying it, read the issue again. If its relevant fields have changed since approval, skip it and ask for another review. A preflight read reduces the chance of overwriting newer work, although it cannot eliminate a race between that read and the write.&lt;/p&gt;

&lt;p&gt;If you control the integration, enforce the approved issue list, permitted fields, and batch size in code. If you only control an agent prompt, treat those limits as instructions whose enforcement you still need to verify.&lt;/p&gt;

&lt;p&gt;Start with a small batch. Save the old values, the attempted operations, and their outcomes somewhere the editing agent cannot modify. A list of successful requests alone won't tell you what to put back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rehearse recovery in a separate workspace
&lt;/h2&gt;

&lt;p&gt;Before trying a bulk cleanup on the live backlog, make a disposable test workspace with a few representative issues. Use synthetic or sanitized content if real tickets contain sensitive information.&lt;/p&gt;

&lt;p&gt;Include cases where a simple rule should fail: an old but important issue, two similar titles that aren't duplicates, a parent with an unresolved sub-issue, and a description containing an essential attachment.&lt;/p&gt;

&lt;p&gt;Then run a small recovery exercise:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Save the starting state and confirm you can read it back.&lt;/li&gt;
&lt;li&gt;Run the agent's proposed task against the test workspace.&lt;/li&gt;
&lt;li&gt;Add a legitimate human edit after the run.&lt;/li&gt;
&lt;li&gt;Recover a wrong status change, an overwritten description, and a deleted test issue using the recovery methods you intend to rely on.&lt;/li&gt;
&lt;li&gt;Check that the legitimate edit and relevant relationships or files survived.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Record how long this takes and which steps need a person. If you are testing a restored copy of real data, check what your restore tool actually carries over; a copy may have different identifiers, users, permissions, or missing features.&lt;/p&gt;

&lt;p&gt;The point of this exercise is to discover those differences while nobody is waiting for their backlog to work again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recovery depends on what changed
&lt;/h2&gt;

&lt;p&gt;Once you discover a bad run, stop further writes first. Revoke the relevant credential or integration authorization, and stop the running automation. Disconnecting a client is only sufficient if that actually removes its ability to keep writing.&lt;/p&gt;

&lt;p&gt;Then separate the damage:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What happened&lt;/th&gt;
&lt;th&gt;What to check before repairing it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Statuses, labels, or assignees changed&lt;/td&gt;
&lt;td&gt;Compare saved values with current values. Preserve any legitimate edits made afterward.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Descriptions were overwritten&lt;/td&gt;
&lt;td&gt;Retrieve the earlier text and merge back the missing content.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Issues were deleted&lt;/td&gt;
&lt;td&gt;Check Linear's Recently deleted items first.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unwanted issues or comments were created&lt;/td&gt;
&lt;td&gt;Identify the specific new records and review their removal.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Linear retains recently deleted issues for 30 days, and its documentation describes restoring them from the team's archives. That gives you a recovery path for deletion; it doesn't undo unrelated field edits or identify unwanted new records. &lt;a href="https://linear.app/docs/delete-archive-issues" rel="noopener noreferrer"&gt;Linear's deletion and recovery documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This distinction matters when choosing a backup tool, too. Ask what its Restore button does to an existing record whose description has changed.&lt;/p&gt;

&lt;p&gt;In BackupLatte, restoring into the original Linear workspace recovers supported missing records and reuses matching existing ones. It &lt;strong&gt;does not overwrite existing records to roll back their fields&lt;/strong&gt;. For overwritten text, you can consult a downloaded snapshot or a copy restored into another workspace, then bring back what you need. The &lt;a href="https://backuplatte.com/docs/restore?utm_source=devto&amp;amp;utm_medium=community&amp;amp;utm_campaign=ai_agent_recovery" rel="noopener noreferrer"&gt;restore guide&lt;/a&gt; explains the behavior and limitations.&lt;/p&gt;

&lt;p&gt;A snapshot also has to predate the mistake and remain available when you discover it. Check its timestamp, coverage, and retention before a consequential run.&lt;/p&gt;

&lt;h2&gt;
  
  
  The question to answer before the first write
&lt;/h2&gt;

&lt;p&gt;Pick one proposed change and ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If this is wrong, where is the previous value, who can recover it, and how will we preserve work done afterward?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you can demonstrate the answer in a test workspace, you have a concrete basis for letting the agent make a small batch of real changes.&lt;/p&gt;

&lt;p&gt;How are you handling this in your team: read-only suggestions, approval for each batch, or autonomous edits with a recovery process you've tested?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>iot</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
