Sure I shouldn’t roll my own crypto but I can write a logger…
Also any part of the program can send data to the logger. This means the logger can receive malicious payloads from anywhere. Maybe your logger handles ascii control characters badly?
Technically you can configure it to send to other places - presumably. In practice you'd be better just redirecting stdout, tailing the file, or installing a mod?
The only even slightly tricky part is like "don't mess unicode up", rest is straightforward. Sure it can be complicated with logging sinks, configurability, when to flush, monitoring and so on but in many cases you just don't need all that. You just build it whenever you do need it.
Capture log messages and write them directly to stderr? That’s easy.
This is where the LLM coded library replacements make sense. When you have non-critical code that can be easily swapped, I’m happy to let an LLM generate a logging package. If I have a need to send log messages out to a separate server for archival? I’d be a little more critical.
But crypto really is just a small thing. I’m not going to design a nuclear reactor but I’ll definitely do stuff that depends on the electricity from one. Similarly one can still do their own authentication; its not like even Apple forgot to rate limit…
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.
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...
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-9Kind of works until the TV, the fridge, a user's BYOD or your printer has infiltrated your LAN.
So it kind of doesn't.
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.
Of course, sometimes simpler is “I stored the passwords unhashed”, so you have to find the middle ground.
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.
The point being, if you weren't committed to maintaining your own implementation of a library before the advent of LLMs, having access to LLMs does not fundamentally change the calculus. The ability to generate code more quickly does not automatically grant an organization the capacity to maintain more code.
Security through obscurity protects you from low effort vulnerability scanners.
It makes you more vulnerable to a sophisticated targeted attack. A competent hacker or AI will quickly find vulnerabilities in your custom libraries.
So why wouldn’t a competent AI find those vulnerabilities during development? I don’t think the proposal is to have human devs hand write the custom libraries and yolo into prod.
(Defence in depth does mitigate this somewhat. The attacker has to be right two or three times)
It probably would. Except it’s internal, and not a reportable CVE, so the fix will be deferred.
I don't know were it will leave us in the long term and I don't think I'll like the answer.
Only where the AI solution is verifiable by the dev doing the promoting and review. Cryptography is probably better served by libraries vetted by experts.
That would be like investing in things one doesn't understand for themselves.
We routinely place trust in things we cannot personally verify.
Ultimately the guarantor of cryptography code won't be humans, it will be councils and red teams comprised of other LLMs.
To be fair, there is more nuance to your statement.
A lot of it depends on your programming language.
For example with Go, with its extensive and excellent stdlib, you would be foolish to rely on large swathes of 3rd party libraries, because so much can and should be done using the Go stdlib.
On the opposite end of the spectrum, you have Rust with an effectively non-existent stdlib.
And the problem you see frequently with Rust is projects importing half the internet, with a Cargo.toml the length of your arm with hundreds of dependencies. Of course the project has never reviewed its dependencies source code, and the project probably barely keeps its dependencies up to date. Its a supply-chain attack waiting to happen, not if but when.
So with languages like Rust, you have to take an approach of "minimal reasonable dependencies", make an active effort to keep your dependency list short and in-control.[1][2]
> less well audited than public libraries
I also struggle with this particular argument because the reality in open source is "well, its open-source, it has many eyes" is in fact mostly a dream. Since we all know 99% of the time its a small group of maintainers (assuming there is are even multiple maintainers[3]) and not many (if any) external reviewers.
[1] https://tweedegolf.nl/en/blog/119/sudo-rs-depencencies-when-... [2] https://tweedegolf.nl/en/blog/104/dealing-with-dependencies-... [3] https://xkcd.com/2347/
What a bullshit.
It's different scenario, different trade offs.
You mitigate risk of library being sold to malicious 3rd party, you avoid risk of your supply chain being hacked, you avoid API/behaviour breaks, etc.
The trade off is that you have to maintain it.
That's why dotnet's ecosystem is so loved due to MS providing 90% of needed libraries, so you avoid some 3rd parties maintained by single person.
Often it can be a very good choice to write the functionality yourself and not rely on external libraries.
And since we now have coding assistants, maintaining in-house costs near nothing now. Nobody else can break us, only ourselves.
> just in your own code that is less well audited than public libraries
why do you think public libraries, which change all the time, get deprecated, handed off and supply-chain attacked are well-audited in any way?
For example, a few years ago I removed a rather large 3rd party mathematics library because we were only using it for a single mathematical function that was very easy to replicate.
Remember, 3rd party libraries need to:
1: Be periodically audited to make sure you are in compliance with the license terms, and preferences of your company.
(1.5: This becomes important during an acquisition as someone will always come around doing due diligence.)
2: Be periodically updated (in case of security bugs)
2.5: Be updated on short notice when a security issue is revealed.
In the case of the mathematics library, replacing it with roughly 20 lines of code and 100 lines of tests is a significantly better tradeoff than constantly reviewing it every time one of the above things happens.
Now, at what point is it "worth it" to use the 3rd party library? In our case we'd need to make much heavier use of the library, probably at least 20 different mathematical functions from it.
If you spend a ton of time hardening your own library code and don't have much feature sure, then that can be a win.