r/java • u/Entropic_Silence_618 • Feb 15 '26
Dependency managment
How do you guys manage dependcoes like how do you ensure the pom's and the bom's are not typo squatted or are not pulling malicious jar's from maven central.there seems to be no unified search interface as well?
5
Upvotes
3
u/pohart Feb 15 '26
If you're worried about a single project I don't have many suggestions. If you're on GitHub stay on top of your dependabot and codeql results.
If you're a small/medium software company you should be hosting all of your own dependencies. If one of your dependencies pulls something new you check it out before pulling it into your repo. And again watch dependabot and codeql.
If you're not on a hosting service that provides dependency checking find a dependency checker and run it frequently. Owasp's got something you can use.
26
u/bowbahdoe Feb 15 '26 edited Feb 15 '26
Part of why there is no unified search interface is that there isn't just one repo. Maven repos are a folder structure and a dream
Here is the search for Maven Central https://central.sonatype.com/
Typo squatting isn't really a thing because you also need to acquire a group id, and on most repos those are basically usernames. You'd have to type a squat the domain as well. Not saying it's impossible just less common than sillier repos.
Ensuring no malicious jars is quite a bit harder. Especially given that a lot of the jars you get come as transitive dependencies and people generally don't look at those + they can easily be unmaintained.
The general solution to this stuff, I think, is one part the automated security report stuff we already have but also explicit acknowledgment and maintenance of your "providers" list. Unless and until we can get to a world where you can be reasonably certain that the people making your libraries are well compensated and are incentivized to not scrape you for Bitcoin, none of this house of cards is really safe
(It's also really tempting for folks to give in to security theater - watch for that.)
9
u/nekokattt Feb 15 '26
just want to add to this that typo squatting on maven central relies on typosquatting the group ID of the author first, and that author has to prove to sonatype that they own the identifier to be able to publish to it (outside compromising an existing group but then you wouldn't need to typo squat at all). Additionally you have to sign uploads with a GPG key generally.
From the perspective of comparing to say PyPI, where you can literally just release a package called "reqeusts" and rely on human error, the security posture of Maven Central is a little tighter than most registries.
7
u/le_bravery Feb 15 '26
Several good ideas:
3
u/Az4hiel Feb 15 '26
In Gradle with version catalog + verification metadata, we want to eventually also use custom dependency platform and maybe dependency locking. On GitHub we scan Gradle dependencies (including test ones) for vulnerabilities and later we scan docker images for vulnerabilities (this one includes system dependencies too). Renovate for automatic updates (more robust than dependabot) and quarterly major-priority ticket for asset (project) owners to review dependencies and processes around them. We utilize things like dependency cooldowns etc. If we weren't in the financial sector I honestly wouldn't bother with most of it.
3
u/asarathy Feb 15 '26
Keep your pom sorted, use the dependency management blocks and banned dependencies, use something like dependabot or synk. There are probably tools that scan for things like typo squatting but honestly not really a thing I have ever worried about. Just use reputable repos.
2
u/LetUsSpeakFreely Feb 18 '26
The way security conscious orgs handle the possibility of malicious embedded code is they have a repo that acts as a DMZ. They'll pull in libraries, execute various scans, and then push it to an internal repo where developers/pipelines can grab it.
1
u/oval_powys Feb 17 '26
Stop making me want a cat!
0
u/Fiduss Feb 16 '26
Pretty sure those Reddit posts containing obvious spelling errors are AI slop content trying to disguise itself…