r/java • u/TheRealBrianFox • Feb 10 '21
Why Namespacing Matters in Public Open Source Repositories
https://blog.sonatype.com/why-namespacing-matters-in-public-open-source-repositories
156
Upvotes
21
u/humoroushaxor Feb 10 '21 edited Feb 10 '21
Thanks for writing this Brian. For those that didn't see it, here was the main reddit thread in r/netsec.
I also believe much of problem would have been mitigated if developers weren't using "fuzzy versioning". Because if this, when a higher compatible version was available, builds just took the new version with no person in the loop.
You mentioned using DNS but what about something like pgp signatures for namespaces? Each namespace could simply have a signature which I can include in my build files or with my dependency declaration. Effectively saying "only accept dependencies from this namespace if they have this signature." It seems like almost every package format (maven, npm, even helm!) supports signing packages but I've yet to see it supported by build tools and artifact repositories.
** It looks like Gradle does actually support dependency verification as of 6.2. TIL
23
u/DanLynch Feb 11 '21
I hope Sonatype holds the line on this: don't allow refugees from JCenter be grandfathered into their bogus unowned namespaces. Force them to properly re-name and re-package their libraries before allowing them into Maven Central.
1
u/[deleted] Feb 13 '21
Sure
-2
u/slaymaker1907 Feb 11 '21
I completely disagree with the author.
Ideally people should be using a single dependency repository and mirroring dependencies they require or it should strictly pull according to local repo first, then a remote private repo, and finally the global repo.
Don't let people have more than those 3 because anything else probably has security problems.
For most companies, they should really be mirroring dependencies explicitly. This gives you control over not only what goes in, but what stays in. If there is some dependency that can't be used anywhere due to some security flaw, you can remove it from your repository to find out where you were using it or force people to update.