<?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: HY LUO</title>
    <description>The latest articles on DEV Community by HY LUO (@loehy).</description>
    <link>https://dev.to/loehy</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%2F4180335%2F26907a30-db22-47a1-8540-a862724f931a.png</url>
      <title>DEV Community: HY LUO</title>
      <link>https://dev.to/loehy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loehy"/>
    <language>en</language>
    <item>
      <title>Keeping sensitive source encrypted on disk while still running Python code</title>
      <dc:creator>HY LUO</dc:creator>
      <pubDate>Fri, 16 Oct 2026 17:02:44 +0000</pubDate>
      <link>https://dev.to/loehy/keeping-sensitive-source-encrypted-on-disk-while-still-running-python-code-4b45</link>
      <guid>https://dev.to/loehy/keeping-sensitive-source-encrypted-on-disk-while-still-running-python-code-4b45</guid>
      <description>&lt;p&gt;AI coding tools need to read project files. Some source code should still stay out of the workspace in plaintext.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://github.com/lo2589/AILatch" rel="noopener noreferrer"&gt;AILatch&lt;/a&gt; for that boundary: files stay encrypted on disk, while Python code can run with plaintext materialized only inside the AILatch process.&lt;/p&gt;

&lt;p&gt;The basic flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ailatch

ailatch lock secret.py
&lt;span class="nb"&gt;cat &lt;/span&gt;secret.py          &lt;span class="c"&gt;# ordinary file reads see ciphertext&lt;/span&gt;
ailatch run secret.py  &lt;span class="c"&gt;# run the program without restoring plaintext&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ailatch run&lt;/code&gt; decrypts the entry file in memory and keeps the working-tree file encrypted. Encrypted Python modules can still import each other, and application code can use normal &lt;code&gt;open()&lt;/code&gt; and &lt;code&gt;pathlib&lt;/code&gt; reads through the runtime hooks.&lt;/p&gt;

&lt;p&gt;When I need to inspect or edit a locked file, AILatch provides a controlled plaintext view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ailatch open &lt;span class="nb"&gt;.&lt;/span&gt;
ailatch show secret.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project also includes encrypted backups and recovery commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ailatch lock secret.py &lt;span class="nt"&gt;--recovery&lt;/span&gt;
ailatch restore secret.py
ailatch recover secret.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is aimed at filesystem-level reads by AI tools and ordinary file utilities. It does not claim to stop a privileged local attacker who can inspect process memory or persuade a user to decrypt a file. Stronger isolation still requires operating-system permissions, process isolation, and careful credential handling.&lt;/p&gt;

&lt;p&gt;AILatch currently targets Python 3.11+ and is primarily tested on Windows and macOS.&lt;/p&gt;

&lt;p&gt;Repository and full command reference: &lt;a href="https://github.com/lo2589/AILatch" rel="noopener noreferrer"&gt;github.com/lo2589/AILatch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tags: #opensource #python #security #ai&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>python</category>
      <category>security</category>
      <category>tools</category>
    </item>
    <item>
      <title>Repairing one malformed JSONL record with JSONSEEK</title>
      <dc:creator>HY LUO</dc:creator>
      <pubDate>Wed, 14 Oct 2026 12:08:53 +0000</pubDate>
      <link>https://dev.to/loehy/repairing-one-malformed-jsonl-record-with-jsonseek-3b81</link>
      <guid>https://dev.to/loehy/repairing-one-malformed-jsonl-record-with-jsonseek-3b81</guid>
      <description>&lt;p&gt;A JSONL file can be awkward to inspect when one record stops parsing. I built &lt;a href="https://github.com/lo2589/JSONSEEK" rel="noopener noreferrer"&gt;JSONSEEK&lt;/a&gt; to make that workflow more focused: locate the bad line, preview a replacement, then check the file again. Disclosure: I’m the project’s author.&lt;/p&gt;

&lt;p&gt;Here’s a small example you can reproduce:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; sample.jsonl &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;'
{"id":1,"name":"Ada"}
{"id":2,"name":"unfinished}
&lt;/span&gt;&lt;span class="no"&gt;EOF

&lt;/span&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;jsonseek
jsonseek shape sample.jsonl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;shape&lt;/code&gt; reports invalid JSONL lines with their line numbers and parser errors. In this example, line 2 is malformed. Once you know what that record should contain, preview the replacement before writing it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jsonseek replaceline sample.jsonl 2 &lt;span class="s1"&gt;'{"id":2,"name":"Grace"}'&lt;/span&gt; &lt;span class="nt"&gt;--dry-run&lt;/span&gt;
jsonseek replaceline sample.jsonl 2 &lt;span class="s1"&gt;'{"id":2,"name":"Grace"}'&lt;/span&gt; &lt;span class="nt"&gt;--backup&lt;/span&gt;
jsonseek shape sample.jsonl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first write command previews the change. The second makes the replacement and requests a &lt;code&gt;.bak&lt;/code&gt; backup. The final &lt;code&gt;shape&lt;/code&gt; call checks the result.&lt;/p&gt;

&lt;p&gt;The same CLI also has path-based commands for inspecting JSON and JSONL (&lt;code&gt;fields&lt;/code&gt;, &lt;code&gt;ls&lt;/code&gt;, and &lt;code&gt;get&lt;/code&gt;), searching with &lt;code&gt;query&lt;/code&gt;, and editing values with commands such as &lt;code&gt;set&lt;/code&gt; and &lt;code&gt;add&lt;/code&gt;. The idea is to inspect the relevant structure or record before changing it.&lt;/p&gt;

&lt;p&gt;JSONSEEK is MIT-licensed. The &lt;a href="https://github.com/lo2589/JSONSEEK" rel="noopener noreferrer"&gt;repository&lt;/a&gt; has the command reference and more examples. If you work with JSONL, how do you usually find and repair a malformed record?&lt;/p&gt;

&lt;p&gt;Tags: #showdev #python #cli #json&lt;/p&gt;

</description>
      <category>showdev</category>
    </item>
  </channel>
</rss>
