đŸ”„ The DB Grill đŸ”„

Where database blog posts get flame-broiled to perfection

SQLite (with WAL) doesn't do `fsync` on each commit under default settings
Originally from avi.im/blag/index.xml
August 24, 2025 ‱ Roasted by Marcus "Zero Trust" Williams Read Original Article

Oh, this is just delightful. "SQLite when used with WAL doesn’t do fsync unless specified." You say that like it's a fun performance trivia fact and not the opening sentence of a future incident post-mortem that will be studied by security students for a decade. It’s not a feature, it's a bug bounty waiting to be claimed. You’ve gift-wrapped a race condition and called it "optimized for concurrency."

Let me translate this from 'move fast and break things' developer-speak into a language that a CISO, or frankly any adult with a functioning sense of object permanence, can understand. What you're celebrating is a database that essentially pinky-promises it wrote your data to disk. The operating system, bless its heart, is told "Hey, just, you know, get to this whenever you feel like it. No rush. I'm sure a sudden power loss or kernel panic won't happen in the next few hundred milliseconds."

I can already see the meeting with the auditors.

"So, walk me through your transaction logging for critical security events. Let's say, for example, an administrator revokes a user's credentials after detecting a breach."

"Well," you'll say, shuffling your feet, "our system immediately processes the request and commits it to the write-ahead log with blazing speed!"

"And that log is durable? It's physically on disk?"

"...It's... specified... to be written. Eventually. We've decided that data integrity is more of a philosophical concept than a hard requirement. We're an agile shop."

You haven't built a database, you've built a Schrödinger's commit. The transaction is both saved and not saved until the moment a GCP zone goes down, at which point you discover it was most definitely not saved. Every single state-changing operation is a potential time-travel exploit for an attacker. Imagine this:

Poof. The machine reboots. The fraudulent transaction? It might have made it to the log file before the OS got around to flushing it. The account lockout and the security log entry? Whoops, they were still floating in a buffer somewhere. To the rest of the system, it never happened. This isn't just a data loss issue; it's a state-confusion vulnerability that allows an attacker to effectively roll back your security measures.

And don't even get me started on compliance. You think you're passing a SOC 2 audit with this? The auditor will take one look at your "ephemeral-by-default" data layer and start laughing. They'll ask for evidence of your data integrity controls (CC7.1), and you'll show them a link to a blog post about how you bravely turned them off for a 5% performance gain on a benchmark you ran on your laptop.

This entire architecture is built on the hope that nothing ever goes wrong. And in the world of security, "hope" is not a strategy; it's a liability. Every single feature you build on top of this flimsy foundation is another potential CVE. User authentication? Potential account takeover via state rollback. Financial ledgers? A great way to invent money. Audit trails? You mean the optional suggestion box?

So, thank you for this fascinating little tidbit. It's always nice to read a short, concise confession of architectural negligence. I'll be sure to file this away under "Companies I Will Never, Ever Work For or Trust With a Single Byte of PII." Anyway, I'm sure this was very enlightening for someone. I, however, will not be reading this blog again. I have to go wash my hands. Thoroughly.