r/Python • • 7d ago

News microsoft agent-framework on PyPI was compromised twice in 33 minutes last night

1.26.1 and 1.26.2 both ship a credential stealer. It runs from a .pth file, so it executes at interpreter startup. Nothing has to import the package, a pip install in CI is enough. 1.26.1 got pulled, then 1.26.2 went up 33 minutes later with the same payload under different file names. Last clean release is 1.26.0.
complete details- https://safedep.io/blog/microsoft-agent-framework-pypi-compromise

461 Upvotes

57 comments sorted by

View all comments

Show parent comment

4

u/Smallpaul 7d ago

Why not put an API key in a secure element and sign requests with it? How is the “private key” more intrinsically secure?

2

u/flooberoo 7d ago edited 7d ago

Because an API key is not used for signing. That's not what is usually understood by API key.

Edit:

Both "API" and "key" are very generic terms, but nowadays, unless otherwise specified, at least I would interpret "API key" as a Bearer token, not a signing key.

2

u/Smallpaul 7d ago

Okay this took me down a rabbit hole with AI.

It seems like what people are gesturing at but nobody is saying explicitly is that API keys should be replaced by something like RFC 7523: JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants.

As opposed to just “Oauth”, which more often simply uses bearer keys like any other API key API. You need Oauth plus a lot more.