Comment by lesuorac

1 month ago

I’d be happy to bet with you if I rolled my own log4j I would have never implemented jndi as a formatting argument.

Sure I shouldn’t roll my own crypto but I can write a logger…

Logging is a very complicated security area. You often get sensitive data in the logs and it gets sent across the network to monitoring servers.

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?

  • I dunno I pretty much always wrote my own logger. Not even a shared library or anything just copypaste into next project or often don't even bother with that, just knock something out on the spot. Even before AI.

    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.

  • Logging is complicated for the general purpose point of view. Most people never need all of those features - which is kind of the point here. Log4j had so many features that 90% of projects didn’t need. Sure, large projects with multiple servers pointing at log receivers is complicated. But how many people were affected by the needs of probably 2 companies?

    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.

  • Imagine that you don't need monitoring servers, like possibly the majority of actual log4j deployments?

    • For example Minecraft uses log4j to write messages to the console and a rotating file.

      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?

      2 replies →

And probably more importantly, AI can write a very simple logger with no extra features than you absolutely need in 5 minutes, if that.

Can, or should?

  • I can’t be bothered to check the exact assembly to see if timing attacks are possible.

    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…