r/coolgithubprojects • • 1d ago

patchmap - CLI tool that maps CycloneDX SBOMs to the exact callsites in the codebase and shows how to migrate breaking changes

https://github.com/cookiengineer/patchmap
2 Upvotes

3 comments sorted by

1

u/cookiengineer 1d ago

Built this over the last couple of days, and it turned out to be a pretty useful tool for me when I want to upgrade dependencies of my codebases and don't know where to start.

It features a couple of modes:

"patchmap scan" shows which vulnerabilities, updates, and breaking changes happen along the way, mapped correctly to your codebase and how you used that dependency in the first place.

"patchmap lint" shows which callsites and data types you have to modify to stay update-compatible. Meaning it diffs and shows which signatures have changed or "will change" when you decide to update your dependencies.

"patchmap sbom" is using CycloneDX's SBOM generator library, and can be used standalone, too.

Overall the linter mode is my favorite way to use it, because this helped me already a LOT during migrations. Thought this tool might be useful for someone else, too. It uses OSV's API behind the scenes, the rest is done 100% offline.

Screenshots: https://imgur.com/a/dTrLUdc

Also check out the examples folder in the repository, which shows typical scenarios and how to use the LSP servers for other programming languages so that it can also parse/lint/verify/map the vulnerabilities to your own codebase.

2

u/ILoveAppSec 1d ago

Tying breaking changes to actual call sites is the part most scanners skip. Worth adding to scan output: flag CVEs where the fix is small but only ships in a breaking release. That patch can often be backported onto the version you already run by vendors that do backports, so the major bump becomes a separate project you schedule, not the cost of closing the CVE. Does scan separate those today?

1

u/cookiengineer 1d ago

Does scan separate those today?

It doesn't in the way you describe in the form of "quick wins" but rather shows "how many steps you can upgrade" directly, or with a breaking change that needs fixing. But if you give it the --to flag with the directly targeted library version you can see the changes necessary to be compatible to that specified version.

The idea is somewhat to run "scan" to get an overview about which new library versions are out there and what kind of vulnerabilities have been fixed with those updates. And then to do a second "lint" run with a --to flag so you can decide for yourself which versions you want to upgrade towards.

That way I don't run into semantic vs actually not really semantically versioned libraries, because honestly nobody seems to give a damn outside the Go ecosystem about correct semantic version compatibility :D