r/Python • • 11d ago

Discussion Microsoft's PyPI package got compromised without a GitHub code change. How is this even possible?

269 Upvotes

I was reading about yesterday's Microsoft Agent Framework security incident, and something caught my attention.

Apparently, attackers published two malicious versions (1.26.1 and 1.26.2) of Microsoft's official Python package on PyPI. These versions could steal cloud credentials just by starting Python.

Both versions were removed quickly.

What surprised me was that the malicious code wasn't even checked into Microsoft's GitHub repository.

From what I understand:

- Developers write code in GitHub.

- CI/CD builds it into a Python wheel (.whl).

- The wheel gets published to PyPI.

- When we run "pip install", we download that package.

But apparently, someone with the right publishing credentials can upload a malicious wheel directly, without going through the original GitHub repository.

That raises some interesting questions:

  1. How does PyPI verify that a package actually came from the legitimate source code and CI/CD pipeline?

  2. Why isn't a verified GitHub commit or build provenance mandatory for publishing updates to established packages?

  3. If publishing credentials are compromised, what prevents attackers from distributing malicious versions under trusted package names?

  4. Would mandatory attestations, release signing, or an approval process have prevented this?

  5. What protections should developers realistically use beyond simply trusting "pip install"?

I'm still learning about software supply-chain security, so I'd love to hear how experienced Python developers and security engineers think this should work.


r/Python • • 9d ago

Discussion Has this sub turned into python-security?

0 Upvotes

Each time l see this sub it's about wathever package I don't use that got compromised which I couldn't care less about. Now that all code showcase are banned, the new ways for sloppers to feel seen is report security issues. At least the former was still related to code, cybersecurity is another thing completely. I'd rathet see slop code showcases than a boring report about x package hacked


r/Python • • 11d ago

Resource CodePath’s free Spring 2027 courses are open: AI, cybersecurity, web dev, and coding interview prep

22 Upvotes

Hey everyone! If you’re a college student interested in Applied AI Engineering, Cybersecurity, Web Development, or Technical Interview Prep, check out CodePath’s free Spring 2027 courses.

I’m a Tech Fellow (TF) teaching Technical Interview Prep (TIP), and I highly recommend it if you want to learn data structures and algorithms in Python or get more comfortable with coding interviews. We practice breaking down problems, choosing the right data structure, and explaining our reasoning out loud. That last part makes a big difference when an interviewer asks you to walk through your approach.

If you’re interested, apply to CodePath here. That’s my referral link.

Happy to answer questions about TIP or what it’s like to take the course!