<?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: sodanisomya</title>
    <description>The latest articles on DEV Community by sodanisomya (@sodanisomya).</description>
    <link>https://dev.to/sodanisomya</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%2F4175024%2F1c266c92-4170-4d72-b1ba-60120766a7d2.png</url>
      <title>DEV Community: sodanisomya</title>
      <link>https://dev.to/sodanisomya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sodanisomya"/>
    <language>en</language>
    <item>
      <title>Out of the box, Presidio doesn't catch Aadhaar numbers. We measured.</title>
      <dc:creator>sodanisomya</dc:creator>
      <pubDate>Sat, 10 Oct 2026 10:08:39 +0000</pubDate>
      <link>https://dev.to/sodanisomya/out-of-the-box-presidio-doesnt-catch-aadhaar-numbers-we-measured-3o46</link>
      <guid>https://dev.to/sodanisomya/out-of-the-box-presidio-doesnt-catch-aadhaar-numbers-we-measured-3o46</guid>
      <description>&lt;p&gt;If you send user text to an LLM API from India, there's a good chance it contains an Aadhaar&lt;br&gt;
number, a PAN, a UPI ID or a phone number. India's DPDP Act sets a compliance deadline of&lt;br&gt;
&lt;strong&gt;13 May 2027&lt;/strong&gt;, and every prompt that leaves your servers is a data-sharing decision.&lt;/p&gt;

&lt;p&gt;The usual answer is "run it through Presidio first". Presidio is excellent, mature, and the&lt;br&gt;
right default for generic PII. But it was built around US/EU data. So we measured how it does&lt;br&gt;
on Indian identifiers.&lt;/p&gt;
&lt;h2&gt;
  
  
  The benchmark
&lt;/h2&gt;

&lt;p&gt;IndiaPII-Bench v1.0 is 2,000 synthetic documents with 13,468 labelled spans across 17 Indian&lt;br&gt;
entity types. Every identifier is synthetic but valid: Aadhaar numbers pass the Verhoeff checksum,&lt;br&gt;
GSTINs pass their check digit, and so on. The corpus is published on Hugging Face&lt;br&gt;
(&lt;code&gt;maskflow-ai/indiapii-bench&lt;/code&gt;), and the harness is one command, so anyone can reproduce it.&lt;/p&gt;

&lt;p&gt;We compared four tools: stock Presidio, Presidio with custom Aadhaar + PAN recognizers,&lt;br&gt;
&lt;code&gt;mask-privacy&lt;/code&gt;, and MaskFlow (the open-source library we built).&lt;/p&gt;
&lt;h2&gt;
  
  
  What we found
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entity&lt;/th&gt;
&lt;th&gt;MaskFlow&lt;/th&gt;
&lt;th&gt;Presidio (stock)&lt;/th&gt;
&lt;th&gt;Presidio + custom&lt;/th&gt;
&lt;th&gt;mask-privacy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Aadhaar&lt;/td&gt;
&lt;td&gt;98.4%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;96.6%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PAN&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSTIN, IFSC, UPI VPA&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indian mobile&lt;/td&gt;
&lt;td&gt;99.0%&lt;/td&gt;
&lt;td&gt;94.9%&lt;/td&gt;
&lt;td&gt;94.9%&lt;/td&gt;
&lt;td&gt;42.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Person name&lt;/td&gt;
&lt;td&gt;52.4%&lt;/td&gt;
&lt;td&gt;30.4%&lt;/td&gt;
&lt;td&gt;30.4%&lt;/td&gt;
&lt;td&gt;30.4%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indian address&lt;/td&gt;
&lt;td&gt;43.3%&lt;/td&gt;
&lt;td&gt;48.2%&lt;/td&gt;
&lt;td&gt;48.2%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;50.7%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;(Partial-overlap F1. "—" means the tool made no predictions for that type.)&lt;/p&gt;

&lt;p&gt;Three takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Default Presidio doesn't detect Aadhaar, PAN, GSTIN, IFSC or UPI IDs.&lt;/strong&gt; You can add
recognizers, and two good regexes get Aadhaar to 96.6%. But most teams don't know they need to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checksums matter.&lt;/strong&gt; A naive 12-digit regex scores 54.4% on Aadhaar, because order numbers
and account numbers look the same. Validating the Verhoeff check digit is what gets you to 98%+.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Names and addresses are hard for everyone.&lt;/strong&gt; We lead on names and lose on addresses, where
mask-privacy is ahead. We publish both.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  What MaskFlow does
&lt;/h2&gt;

&lt;p&gt;MaskFlow replaces PII with typed, reversible placeholders before text leaves your process, and&lt;br&gt;
restores the real values in the response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;maskflow&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;unmask&lt;/span&gt;

&lt;span class="c1"&gt;# Synthetic Aadhaar number: passes the Verhoeff checksum, belongs to no one.
&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;My Aadhaar is 2346 8907 6549 and you can reach me at alice@example.com.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;masked_text&lt;/span&gt;
&lt;span class="c1"&gt;# "My Aadhaar is &amp;lt;AADHAAR_1&amp;gt; and you can reach me at &amp;lt;EMAIL_1&amp;gt;."
&lt;/span&gt;&lt;span class="nf"&gt;unmask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;masked_text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# original text, restored
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model sees &lt;code&gt;&amp;lt;AADHAAR_1&amp;gt;&lt;/code&gt;, so it can still write a sensible reply, and your user sees their&lt;br&gt;
real details. It's MIT-licensed, runs entirely on your infrastructure, and plugs into LiteLLM,&lt;br&gt;
LangChain, LlamaIndex and MCP, or runs as an OpenAI-compatible gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Names in Devanagari script are detected only after a cue such as &lt;code&gt;नाम:&lt;/code&gt; or &lt;code&gt;श्री&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Address detection is weaker than we'd like (43.3% F1).&lt;/li&gt;
&lt;li&gt;The benchmark is synthetic. Real text is messier, so run &lt;code&gt;maskflow bench --my-data&lt;/code&gt; on your own
labelled data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code: &lt;a href="https://github.com/maskflow/maskflow" rel="noopener noreferrer"&gt;https://github.com/maskflow/maskflow&lt;/a&gt; · Benchmark: &lt;a href="https://maskflow.in/benchmark" rel="noopener noreferrer"&gt;https://maskflow.in/benchmark&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If it's useful, a ⭐ on GitHub helps other teams find it.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>llm</category>
      <category>privacy</category>
      <category>security</category>
    </item>
  </channel>
</rss>
