frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Why the KeePass format should be based on SQLite

https://mketab.org/blog/sqlite_kdbx/
50•wps•6h ago

Comments

ycombinatrix•6h ago
>Important to note is that every time a KDBX file is updated, no matter how small the edit was, the entire file gets rewritten.

This seems like an implementation issue rather than a format/spec issue.

wps•6h ago
Because KDBX is a gzipped and encrypted stream, this is actually fundamentally an issue with the spec itself. A client must re-encrypt and compress the file prior to writing because a mere append operation is not possible. SQLite solves this issue by allowing you to write with page level granularity rather than being forced to dump the whole file for a single tiny change!
ycombinatrix•6h ago
I see, thanks. Have you considered moving to Bitwarden?
wps•6h ago
Yes actually, I have personally onboarded several people to BitWarden! (Including manually migrating their accounts, setting passwords and passkeys, etc) However, I dislike the centralization and lack of control. There was a paper discussed within the past couple days on HN about what a malicious BitWarden server was capable of, despite BitWarden's marketing. I believe BitWarden's team responded promptly and appropriately to the research.

VaultWarden is a good compromise (offers the choice of SQLite or Postgres under the hood), putting you in charge of the primary server, but it is honestly overkill for a single personal user compared to a kdbx file on a webdav share.

clircle•1h ago
> overkill for a single personal user compared to a kdbx file on a webdav share.

Maybe. I'm looking into VaultWarden for my personal passwords because keeping a KBDX file up to date on iOS is painful (without a corporate cloud backing).

ptx•1h ago
Couldn't they simply switch to zip files? Those have an index and allow opening individual files within the archive without reading the whole thing.

Also, I don't understand how using XML makes for a brittle schema and how SQL would solve it. If clients choke on unexpected XML elements, they could also do a "SELECT *" in SQL and choke on unexpected columns. And the problem with people adding different attributes seems like just the thing XML namespaces was designed for.

lukeschlather•53m ago
It's a single XML file. Zip sounds like the worst of both worlds. You would need a new schema that had individual files at some level (probably at the "row level.") The article mentions SQLCipher which allows encrypting individual values separately with different keys. Using different keys for different parts of a kdbx sounds ridiculous, but I could totally imagine each row being encrypted with a compound key - a database-level key and a row-level key, or using PKI with a hardware token so that you don't need to decrypt the whole row to read a single field, and a passive observer with access to the machine's memory can't gain access to secrets the user didn't explicitly request.
kbolino•24m ago
A ZIP file with solid encryption (i.e., the archive is encrypted as a single whole) has all of the same tradeoffs as a KDBX file as far as incremental updates are concerned.

A ZIP file with incremental encryption (i.e., each file is individually encrypted as a separate item) has its own problems. Notably: the file names are exposed (though this can be mitigated), the file metadata is not authenticated, and the central directory is not authenticated. So sure, you can read that index, but you can't trust it, so what good is it doing? Also, to support incremental updates, you'd either have to keep all the old versions of a file around, or else remove them and end up rewriting most/all of the archive anyway. It's frankly just not a very good format.

zzrrt•3m ago
> SQLite solves this issue by allowing you to write with page level granularity rather than being forced to dump the whole file for a single tiny change!

Smaller ideas that would address this: add support for non-CBC encryption modes, tweak/disable the compression so that small changes require less rewriting.

PunchyHamster•2h ago
You need format supporting append/edit first before you can implement it "right"
mathfailure•2h ago
That's probably a security feature.
foobiekr•1h ago
It's not an issue, write-new-and-swap is probably the best approach for this type of application.
rileymichael•1h ago
i would say it’s the correct implementation as you can’t edit atomically. write and move is what you have to do
dietr1ch•39m ago
It's a file in the 10-500kB and passwords are read way more often than added.

If it's even tracked as an implementation issue, it probably ranks very low and fixing this requires a lot of care not to screw up things with the safety and feature rollout.

PunchyHamster•2h ago
I don't think given the file size it is all that relevant.

I mean if I wanted to start new password manager right now it would be a good choice to "just use SQLite" but for existing solution backward compatibility is far more important

jamespo•1h ago
Just checking the size of my .kdbx file: under 100K.
PaulKeeble•49m ago
130KB, I don't store anything in it but username/passwords and a couple of passkeys.
ptx•1h ago
> My cursory (lol, get it?) understanding may be incorrect.

I don't get it. Is this a reference to database cursors? Or is it implying that the blog post was AI generated?

advisedwang•1h ago
> Devising a new schema based on SQLite would allow for current features that are being jerry-rigged into the attributes to have their own real place in the database

Perfectly possible with XML too

> An SQLite based store is one of the most tested and optimal formats for document and application storage

It's optimized for things that largely don't matter for password storage. The testing is admirable, but there's no issue of keepass clients crashing or corrupting data so again, not very relevant (probably because of low concurrency, simple writes etc).

> A switch this big is a major chance to fix the governance structure and align it more with a democratic consortium than a benevolent-dictator-for-life style of project management

You don't need a technical change to solve this. In fact, a fork that would fracture clients is the last thing you need when making governance changes.

> So many quality of life features can be added where the old schema disallowed it

All of the features they list can be achieved with an XML format. The format isn't what's holding them back.

ctoth•58m ago
> All of the features they list can be achieved with an XML format.

Not writing the entire database on every save?

hollow-moe•55m ago
I don't know if this could count as "corrupting": I made the mistake of syncing my keepassxc database to my macbook with finder webdav client (nextcloud backend) it read the file alright but when I tried to write a new secret it helpfully wrote an empty file in place, wiping nextcloud file versions in the process. Thankfully, Nextcloud was smart enough to move the previous file in the trash bin and I could restore it. It seems keepassxc "save" procedure here was to delete the old file and replace it with a new one and something went catastrophically wrong in the process ? Looking at the settings there's is a parameter for this method for particular circumstances but I didn't enable it back then. Now I just have a second database only on this mac synced to icloud and never letting it near my nextcloud again.
Bender•1h ago
Is kdbx broken or has it been causing data loss? I've been using KeepassXC as long as it has existed and no issues for me thus far. If kdbx is not problematic for it's intended use then I think moving to SQLite just makes it more hacker friendly which I have no need for. I have no need for other applications extending the use of my passwords.

If anything, maybe give people the option to export to SQLite and then use that going forward but keep it entirely optional.

ctoth•59m ago
I don't want to assume you didn't read the article, but this isn't really about the database engine. It's about the shadow schema that has grown up around the format. The database switch would serve as a flag day to unify things. It won't be a permanent fix, nothing at this scale ever is, and we'll probably need another migration in a few decades. Still worth doing.
Bender•47m ago
I read it and I get it but I have never run into problems with KP using its existing schema. The only reason I could see this debate making sense would be if third parties want to integrate with it otherwise it works perfectly fine. And sure if it's worth doing then make it optional like I said. Have an export as SQLite, MySQL, Postgres, Oracle, DB2 but keep it optional given there is no need otherwise. This is solving a perceived problem that does not exist or creating a problem where there isn't one.

As for scale this app is for one person doing one query at a time or saving one password at a time. One person will not be saving millions of passwords or if for some reason they are then they can export to a format that an enterprise solution could take it's place. People have written team / company password managers that can use Oracle, MySQL and Postgres that can track and audit user and team password changes. This is not something that should ever be expected of an individual personal password manager like KeepassXC.

This is just my take but I would rather have the maintainers of KP focus on bugs, usability issues, quality of life enhancements which they have been doing great thus far in my opinion. Forcing a schema migration is just asking for trouble and potentially causing bugs that turn some people away from using it or cause people to lose data if they do not have snapshots of their database. Or if forcing a schema change make for damn sure there are many backups in each format and encourage the users to back up all the files to many external encrypted drives and store some of the encrypted devices off-site.

subdavis•1h ago
The keepass ecosystem is comprised of a dozen implementations of the KDB(X) file spec. Some are better than others.

I built KeePass Tusk back in 2018, for example. This would kill the project and abandon 30K users without a rewrite of the JS engine (there are several now!)

I agree with you that KDBX sucks, but at this point a keepass based on SQLite would be keepass in name only, a new password manager to migrate to.

zokier•57m ago
If you are serious about this proposal, one way to move forwards is to make tool that converts kdbx <-> sqlite. If you can't roundtrip that conversion perfectly then the idea is dead on arrival.
Kwpolska•54m ago
> So rather than risking sync issues uploading your 20MiB KDBX file on every minor change, you can upload just the 4KiB or so comprising that data.

Why is your KDBX file 20 MiB? It seems you are storing something that is not actually a good fit for a password manager, and expecting the entire world to change around you instead of storing those files in a more appropriate place.

ctoth•51m ago
"The reasonable man adapts himself to the world; the unreasonable man persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man."

My kdbx is only 173 KB, but I don't hate this idea.

NoMoreNicksLeft•27m ago
I don't use KP, but I have a pdf for my floor safe in my password manager. I only open it a few times per year and I need more than just the combination, I need instructions on whether the first number is cw or ccw. While I could no doubt look it up on the internet every time, I was fearful that the user's manual might some day disappear from the internet. Some things that aren't obviously passwords still belong in a password manager.
ifh-hn•22m ago
Were that me (I used KP), it would be in a different kdbx file. This is one of the benefits of KP, I have about 8 different vaults for various things. I don't like putting my eggs in one basket.
quesera•5m ago
In my mental model, the PDF is not a secret and can be stored anywhere -- encrypted, if that's your thing, but it sounds like a public document.

The safe combination is a secret, and obviously belongs in secret storage.

In this specific example, if I had trouble remembering whether the first digit was cw or ccw, I'd include it in the secret, e.g. "cw34-12-22-45".

(Some safe combinations require multiple rotations. I unintentionally became the owner of one that is something like "cw3x34-ccw2x12-cw5x22-ccw2x45". I still can't open it actually, but that pattern is what the Internet tells me. :)

gerdesj•2m ago
We have a single kdbx with nearly 7000 entries. It is about 45MB at the moment with very few text docs in it. It once got to over 100MB when I found people using it as a doc store but it had a bit of a clear out a few years back.
krick•39m ago
Maybe it's irrational, and I cannot actually justify it (and of course safe writing is of primary importance), but somehow rewriting the whole file feels like a good thing for a secrets storage. Updating only part of a file obviously reveals something, even though it probably shouldn't matter if it doesn't reveal anything useful. But the default mode of thinking is we can never assume the leaked information cannot be used somehow.
therein•36m ago
I do use it, and rewriting the whole file annoys me especially when the storage is not local and the database contains sizable blobs. For storing passwords and short secrets, it makes little to no difference but if I have 10 1MB blobs stored in there, it becomes upsetting.
krick•30m ago
Well, yes, this is what OP is saying, and I'm not arguing against that. However, this is not what *.kdbx was designed for. And I am only talking about what cryptographically changes for the intended use case if we encrypt every page separately.
ifh-hn•26m ago
The schema issues aren't solved by moving to sqlite, or the proposed solution is doable with XML too. I can see the same thing with the attributes (some described it as a shadow schema) happening in an attributes table just as easily. And in my experience relational schemas are a lot harder to modify than a document schema like XML.

EDIT: also you don't need to have just one password vault and I'd say you probably shouldn't, separate entries also assist with separation of concerns. This last adds a little overhead but is a reasonable workaround.

However on the whole I like sqlite for app persistence. It can, however, leak data (forensically) if not managed properly.

kgwxd•24m ago
Some decent arguments for development concerns, but the users will certainly never notice.

For 10 years I've managed a family of 4 in a single KeePass db. Unique passwords across all accounts, random passwords instead of PII for "security questions", fake DOBs, and all other random security related stuff. Never had a single issue. Everything happens instantly as far as I can tell. And the file is 67kb.

My work dbs, separate only because they should be, are much smaller and simpler.

I love KeePass. Changing everything under the hood probably only has potential to make pain for the user. Best case is that nothing is made noticeably worse. Doesn't seem worth the risk.

kbolino•19m ago
SQLCipher is not SQLite.

A key aspect of SQLite's development model is its proprietary test suite. As far as I can tell, the SQLCipher developers do not have access to those tests.

This is not to say they aren't doing the best with what they've got, but SQLCipher is a fork of SQLite, and the scope of the changes they must make, no matter how conservatively they try to make them, should lead to a full re-test of the entire product, which they cannot do.

TheChaplain•2m ago
Just create a new password manager using SQLCipher then? If it is good enough people will use it.

It is weird when people wants to change something that works just great.

KeePass have served me well for years on Windows, Mac, Android, Linux using Dropbox and Syncthing as storage. Don't mess with it.

I'm helping my dog vibe code games

https://www.calebleak.com/posts/dog-game/
288•cleak•2h ago•97 comments

I pitched a roller coaster to Disneyland at age 10 in 1978

https://wordglyph.xyz/one-piece-at-a-time
317•wordglyph•7h ago•110 comments

Nearby Glasses

https://github.com/yjeanrenaud/yj_nearbyglasses
58•zingerlio•2h ago•27 comments

HuggingFace Agent Skills

https://github.com/huggingface/skills
41•armcat•2h ago•8 comments

I think WebRTC is better than SSH-ing for connecting to Mac terminal from iPhone

https://macky.dev
21•Sayuj01•1h ago•16 comments

IRS Tactics Against Meta Open a New Front in the Corporate Tax Fight

https://www.nytimes.com/2026/02/24/business/irs-meta-corporate-taxes.html
146•mitchbob•7h ago•165 comments

Open Letter to Google on Mandatory Developer Registration for App Distribution

https://keepandroidopen.org/open-letter/
220•kaplun•2h ago•137 comments

Tesla registrations crash 17% in Europe as BEV market surges 14%

https://electrek.co/2026/02/24/tesla-eu-registrations-crash-january-2026-bev-growth/
141•breve•1h ago•102 comments

Steel Bank Common Lisp

https://www.sbcl.org/
51•tosh•1h ago•9 comments

We installed a single turnstile to feel secure

https://idiallo.com/blog/installed-single-turnstile-for-security-theater
181•firefoxd•1d ago•74 comments

Extending C with Prolog (1994)

https://www.amzi.com/articles/irq_expert_system.htm
44•Antibabelic•2d ago•17 comments

Verge (YC S15) Is Hiring a Director of Computational Biology and AI Scientists/Eng

https://jobs.ashbyhq.com/verge-genomics
1•alicexzhang•3h ago

OpenAI resets spending expectations, from $1.4T to $600B

https://www.cnbc.com/2026/02/20/openai-resets-spend-expectations-targets-around-600-billion-by-20...
82•randycupertino•1h ago•49 comments

Diode – Build, program, and simulate hardware

https://www.withdiode.com/
393•rossant•3d ago•89 comments

Samsung Upcycle Promise

https://www.xda-developers.com/samsung-promised-make-old-phones-useful-galaxy-upcycle/
144•1970-01-01•1d ago•83 comments

Osaka: Kansai Airport proud to have never lost single piece of luggage (2024)

https://japannews.yomiuri.co.jp/features/japan-focus/20241228-229891/
159•thunderbong•3h ago•56 comments

OpenAI, the US government and Persona built an identity surveillance machine

https://vmfunc.re/blog/persona/
266•rzk•1h ago•79 comments

Show HN: Emdash – Open-source agentic development environment

https://github.com/generalaction/emdash
22•onecommit•2h ago•9 comments

Why the KeePass format should be based on SQLite

https://mketab.org/blog/sqlite_kdbx/
50•wps•6h ago•39 comments

λProlog: Logic programming in higher-order logic

https://www.lix.polytechnique.fr/Labo/Dale.Miller/lProlog/
121•ux266478•3d ago•35 comments

IDF killed Gaza aid workers at point blank range in 2025 massacre: Report

https://www.dropsitenews.com/p/israeli-soldiers-tel-sultan-gaza-red-crescent-civil-defense-massac...
438•Qem•7h ago•84 comments

The Missing Semester of Your CS Education – Revised for 2026

https://missing.csail.mit.edu/
330•anishathalye•1d ago•93 comments

Show HN: Chaos Monkey but for Audio Video Testing (WebRTC and UDP)

https://github.com/MdSadiqMd/AV-Chaos-Monkey
4•MdSadiqMd•1d ago•0 comments

Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection in Firefox 148

https://hacks.mozilla.org/2026/02/goodbye-innerhtml-hello-sethtml-stronger-xss-protection-in-fire...
283•todsacerdoti•7h ago•126 comments

Terence Tao, at 8 years old (1984) [pdf]

https://gwern.net/doc/iq/high/smpy/1984-clements.pdf
450•gurjeet•1d ago•273 comments

Denver dumps Flock, awards contract to Axon

https://www.9news.com/article/news/local/denver-removing-flock-cameras-new-axon-contract/73-640b5...
60•therobots927•2h ago•24 comments

A distributed queue in a single JSON file on object storage

https://turbopuffer.com/blog/object-storage-queue
137•Sirupsen•3d ago•48 comments

Cardiorespiratory fitness is associated with lower anger and anxiety

https://linkinghub.elsevier.com/retrieve/pii/S000169182600171X
64•PaulHoule•3h ago•57 comments

Stripe valued at $159B, 2025 annual letter

https://stripe.com/newsroom/news/stripe-2025-update
144•jez•5h ago•155 comments

Discord cuts ties with identity verification software, Persona

https://fortune.com/2026/02/24/discord-peter-thiel-backed-persona-identity-verification-breach/
363•robtherobber•8h ago•249 comments