<?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: Priyanshu Kumari</title>
    <description>The latest articles on DEV Community by Priyanshu Kumari (@sitara2007).</description>
    <link>https://dev.to/sitara2007</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%2F4199027%2Fe78d1395-7d64-4319-b8e5-867aa459c996.png</url>
      <title>DEV Community: Priyanshu Kumari</title>
      <link>https://dev.to/sitara2007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sitara2007"/>
    <language>en</language>
    <item>
      <title>How uv add silently downgraded my pypdf security patch (and how I fixed it)</title>
      <dc:creator>Priyanshu Kumari</dc:creator>
      <pubDate>Wed, 04 Nov 2026 00:41:52 +0000</pubDate>
      <link>https://dev.to/sitara2007/how-uv-add-silently-downgraded-my-pypdf-security-patch-and-how-i-fixed-it-lk0</link>
      <guid>https://dev.to/sitara2007/how-uv-add-silently-downgraded-my-pypdf-security-patch-and-how-i-fixed-it-lk0</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld48e2qo2fmo3fm83zsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld48e2qo2fmo3fm83zsk.png" alt=" " width="800" height="791"&gt;&lt;/a&gt;I merged two PRs to fix my dependency alerts on GitHub. Both had empty diffs.&lt;/p&gt;

&lt;p&gt;GitHub kept showing 11 open Dependabot alerts (10 high, 1 moderate). It was right, and I was wrong.&lt;/p&gt;

&lt;p&gt;When I dug into my terminal, I saw this:&lt;/p&gt;

&lt;p&gt;text&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pypdf==6.21.4&lt;/li&gt;
&lt;li&gt;pypdf==6.21.1
My security patch was silently downgraded. Here is exactly why it happened and how to fix it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why did uv add downgrade my package?&lt;br&gt;
I was working on CivicAI, an open-source PII redaction pipeline. I ran uv add presidio-analyzer presidio-anonymizer to add a new feature.&lt;/p&gt;

&lt;p&gt;However, my local main branch was 5 commits behind origin/main.&lt;/p&gt;

&lt;p&gt;pyproject.toml said "pypdf&amp;gt;=4.0".&lt;/p&gt;

&lt;p&gt;My local uv.lock was stale and had pypdf 6.21.1 cached.&lt;/p&gt;

&lt;p&gt;The resolver saw that 6.21.1 satisfied &amp;gt;=4.0, so it silently kept the vulnerable version.&lt;/p&gt;

&lt;p&gt;I pushed the code. The tests passed. But the lockfile still had vulnerabilities.&lt;/p&gt;

&lt;p&gt;The fix that actually sticks&lt;br&gt;
You cannot just fix the lockfile; you have to fix the rules so it can't happen again.&lt;/p&gt;

&lt;p&gt;Step 1: Sync your local repo&lt;/p&gt;

&lt;p&gt;bash&lt;br&gt;
git fetch origin&lt;br&gt;
git rebase origin/main&lt;br&gt;
Step 2: Force the upgrade&lt;/p&gt;

&lt;p&gt;bash&lt;br&gt;
uv lock --upgrade-package pypdf&lt;br&gt;
Step 3: Raise the floor in pyproject.toml&lt;br&gt;
Change "pypdf&amp;gt;=4.0" to "pypdf&amp;gt;=6.21.4".&lt;br&gt;
This is the most important step. By raising the floor, even if a developer runs uv add on a stale lockfile, the resolver is forced to install 6.21.4 or higher.&lt;/p&gt;

&lt;p&gt;Step 4: Declare your test dependencies&lt;br&gt;
I also noticed my Presidio integration test was silently skipping on a fresh clone because presidio-analyzer wasn't in pyproject.toml.&lt;/p&gt;

&lt;p&gt;toml&lt;/p&gt;

&lt;h1&gt;
  
  
  pyproject.toml
&lt;/h1&gt;

&lt;p&gt;dependencies = [&lt;br&gt;
    "pypdf&amp;gt;=6.21.4",&lt;br&gt;
    "presidio-analyzer&amp;gt;=2.2.0",&lt;br&gt;
    "presidio-anonymizer&amp;gt;=2.2.0",&lt;br&gt;
]&lt;br&gt;
Result:&lt;/p&gt;

&lt;p&gt;bash&lt;br&gt;
$ gh api repos/sitara2007/CivicAI/dependabot/alerts --jq '[.[]|select(.state=="open")]|length'&lt;br&gt;
0&lt;br&gt;
Tests: 28 passed, 1 skipped (tested against real Postgres).&lt;/p&gt;

&lt;p&gt;The Takeaway for Engineers&lt;br&gt;
A merged PR isn’t a fix until the lockfile diff proves it. Always run git diff uv.lock before merging.&lt;/p&gt;

&lt;p&gt;A skipped test is a signal, not a pass. If a test skips because a dependency isn't declared, your CI is lying to you.&lt;/p&gt;

&lt;p&gt;Passing tests, dependency scanning, and code scanning answer different questions. You need all three.&lt;/p&gt;

&lt;p&gt;I'm building CivicAI, an open-source PII redaction pipeline with a tamper-evident audit log. If your team sends sensitive text to LLMs, what's the hardest part of redaction today?&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/sitara2007/CivicAI" rel="noopener noreferrer"&gt;https://github.com/sitara2007/CivicAI&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>github</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
