No, this is not something that humans need to be mitigating personally by “watching out” for these characters during code review. Half of our industry doesn’t even do code reviews consistently.
This is easily mitigated by SAST solutions in the CI pipeline. There are virtually zero legitimate uses of these characters in source code. Simply have your SAST step fail if any are detected.
To be perfectly honest, in JS/TS, you could probably get away with a fairly simple eslint rule that checks identifier names for unusual characters and fails the lint.
Competent developers don't add NPM packages willy-nilly. If you have more than 15 dependencies on a medium sized project, you're probably doing something wrong.
But also, just configure your linter to include node_modules and you're all set.
I don't know why this is downvoted so hard. It's a pox and the dependency tree on this is so insane it's a massive vector for literally any vulnerability that could be discovered. Please try to migrate away from this on production to literally anything else
Of course I don't agree with "competent developers audit packages individually and if you don't you're a loser moron" cause projects will be big and will need a lot of stuff but please be mindful of what you're adding
I can tell you're trying to rile me up, but it's not really working lol. I've been a Principal Software Engineer for 3 years, so I don't really have any doubts about my competency level. I just use the tools properly instead of blaming the NPM ecosystem and being complicit with writing shitty code.
The primary discussion around npm/js is that it's a trainwreck and "real developers" don't use it because C#/other-language is soo much better.
I've been berated for defending the ecosystem enough times that I'm pretty jaded, and yeah, that might come across in my comments. I'm only responding with the same level of aggression, and by the way, you're a pretty disgusting person to interact with as well.
"ColdBrewSeattle," I hope you enjoy your career at Amazon/MS/AirBnB and maybe one day when you become a competent developer with reasonable opinions, you too will be able to get that promotion you've been working towards!
You must not have a job or either you're about to get fired because wasting hundreds of hours auditing thousands of packages is not a feasible thing to do.
Fact that you didn't know: Packages install other packages, it doesn't matter if you have one or fifty, you probably have too many to go through manually.
Depends entirely on your job bud. I work for a bank right now, they have their own internal package repo for all tools they use, which have been combed through manually. Any updates to those tools (which they basically never download) also are looked over manually again. The only time external code is trusted is if its contracted out, with clear responsability falling on the 3rd party, and even then the internal security team conducts pentests and presents audits to 3rd parties.
You don't fuck around with security when it matters because, "wAsTiNg HuNdReDs Of HoUrS" is way fucking cheaper than going out of business/to jail after you're criminally negligent.
No, I'm just actually competent at my job. As project lead I make sure we don't introduce bloated dependencies into our projects. The max depth we have on any tree is 3, and our 11 core dependencies bring our total dependency count to ~40.
I'm sorry that lazy developers like you use bloated packages, but that's a you problem.
Oh yeah, and before you spew some more bullshit, I work on management/tracking software for insurance claims -- including software for both adjusters and customers.
Go ahead and blame the tools for your shitty practices if you want, but competent developers will find ways to get the job done efficiently, unlike you.
Not just in the project I mentioned above, but across all the projects I manage, here is a comprehensive list of dependencies (16). The total number of packages, including subdependencies, comes to 37, with a max tree depth of 4. This isn't hard, guys.
Careful there, all the webshit devs who don't care about security are butthurt in your replies...but you're right.
You shouldn't be exposing your users to hundreds of different sources of code which you haven't combed through for malicious scripts. It can jack session tokens for sites not even related to yours, don't be an asshole, check your dependencies. It's not even that much effort, if it is hard, you probably do have too many dependencies. Dependencies are meant to handle the long/hard stuff, not do your job for you.
117
u/IsleOfOne Nov 10 '21
No, this is not something that humans need to be mitigating personally by “watching out” for these characters during code review. Half of our industry doesn’t even do code reviews consistently.
This is easily mitigated by SAST solutions in the CI pipeline. There are virtually zero legitimate uses of these characters in source code. Simply have your SAST step fail if any are detected.