by sans_souse · 2y ago · 0 comments
> It seems that the original author
> - Briefly added the authorization token to their source code
> - Ran the source code (Python script), which got compiled into a .pyc binary with the auth token
> - Removed the authorization token from the source code, but didn’t clean the .pyc
> - Pushed both the clean source code and the unclean .pyc binary into the docker image
Oof.
Honestly, I can't blame the guy for a mistake like this, it's just so easy to make. But then again, deploying images built on a development laptop is generally an error-prone activity. This is why build and deployment servers exist.
Why is Python still running any classic access tokens?
Why is the access token EVER in the source code?
What other stuff is “running on their laptop”?
No pass!
People with access to the repos shouldn’t also have access to push bits to the world. It puts those people with that access in grave physical danger.
Edit, https://blog.pypi.org/posts/2024-07-08-incident-report-leake...
This token has been in the wild for 15 months! The JFrog post cannot say that disaster was averted because we do not know.
"Binary secret scanning helped us prevent (what might have been) the worst supply chain attack you can imagine"
The above comment from them sounds as weird, as the whole ecosystem security based out of a developer laptop...
When I create a project now I automatically place a catch all ignore for both git and docker.
Binaries, .env files have a far lower chance to end up tracked in a repo or copied over to a container image.
Use environment variables or better yet - store the secret on the disk outside of your repo and make the code read it. It's a one liner in plenty of languages.