← Back to context

Comment by BatteryMountain

1 month ago

I understand, but I would argue its better to have an in-house 1K lines of code that only does what we need and nothing else, it well tested and under our control, than to depend on some 50K lines of code (of which we might only use 10% of functionality and the others just getting in the way) that random's on the internet can modify, sometimes pulling in transient dependencies that we would really not have in a server environment, telemetry and other gremlins. It goes without saying that opensource packages will become even more juicy targets for malware/hackers to get into your systems like we've seen in the past month (and it will only become worse - you will be forced to pay technical debt or die).

The only "third-party" packages that we want to ideally allow/support would be provided from LTS versions of our runtime (in this case, packages provided by the dotnet team and audited by microsoft). So we will always try to build around what the framework provides. Second choice is our own code, third choice is open-source packages, fouth choice is a separate application/appliance (lets say ZenDesk for ticketing). Over time, we will reduce this footprint to only have dotnet team code and our own.

Remember most CVE's can be hidden on servers that are not publicly routable and don't have a real exploitation paths. The bits that are public (lets say a linux edge server with a web server on it, some firewalls, a couple of open ports) - these should be hardened to the max and not allow full access to all the services running behind it. We don't even give our internal services public IP addresses to make near impossible to route traffic to them.

Our git repo's are also not on public infrastructure (serious, think carefully about hosting on public services and if you really need it), never mind making the repo public.

We also have a dedicated secrets/certs manager, so no credentials are in codebases or pipelines. Very strict in this regard.

> Remember most CVE's can be hidden on servers that are not publicly routable and don't have a real exploitation paths.

The thinking of "it's inside so we're safe(r) from attacks" is a false sense of security, as (e.g.) Maersk learned with NotPetya:

* https://www.wired.com/story/notpetya-cyberattack-ukraine-rus...

* https://archive.is/Amlij

From the year 2000:

   NAT (particularly NAPT) actually has the potential to lower overall
   security because it creates the illusion of a security barrier, but
   does so without the managed intent of a firewall.  Appropriate
   security mechanisms are implemented in the end host, without reliance
   on assumptions about routing hacks, firewall filters, or missing NAT
   translations, which may change over time to enable a service to a
   neighboring host.  In general, defined security barriers assume that
   any threats are external, leading to practices that make internal
   breaches much easier.

* https://datatracker.ietf.org/doc/html/rfc2993#section-9

  • > it's inside so we're safe(r) from attacks

    Kind of works until the TV, the fridge, a user's BYOD or your printer has infiltrated your LAN.

    So it kind of doesn't.

  • It's a defense-in-depth thing, not our only layer of security. So even if they somehow get in, they will find nothing again, every layer deeper becomes harder. Oh and don't count the decoys and honeypots we have floating around to keep the morons occupied.

> on some 50K lines of code

also some 3rd party libraries are overdesigned/overcomplicated because everybody wants the library to do everything for everybody.

This overcomplication can easily introduce security problems that is not present in the 1K solution.

  • > overdesigned/overcomplicated because everybody wants the library to do everything for everybody.

    Also a source of significant dependency churn even excluding security bugs.

    Whereas with my own code I don't have to worry about scheduling work that's only arisen because somebody outside my organisation has decided to make a breaking change in a dependency. Paying that tax got old over a decade ago, and my patience with it now is close to zero.

  • Thinking about Log4J here. The vulnerability was with an obscure functionality that I’ve never seen used. Sometimes simpler is safer.

    Of course, sometimes simpler is “I stored the passwords unhashed”, so you have to find the middle ground.

  • cough OpenSSL cough

    • As every cryptographer will surely agree, having every company vibecode their own bespoke in-house replacement to OpenSSL will be a great improvement to security across the industry.

      2 replies →

    • After Heartbleed the OpenSSL team upped their game so much, that LibreSSL guys said themselves that LibreSSL is obsolet now. So this no longer stands true. Just use OpenSSL.

I would rather let someone else pay the price of maintaining 50k lines of code than to pay the technical debt of 1k loc myself.

  • Do you pay for everything in package.json or pyproject.toml (or <packagemanagerX>)?

You might believe that your own 1 KLOC is well tested but you're probably wrong. As your business evolves and use cases expand, someone will feed it bizarre inputs that you never thought to test and then it will break. I've seen this happen over and over.